:root {
  font-family: "Source Sans 3", "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.45;
  color: #193548;
  background: #edf3f7;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { min-height: 46px; padding: .55em .9em; border: 1px solid #a8bdcc; border-radius: 8px; background: #fff; cursor: pointer; }
button:disabled { cursor: default; color: #63778a; background: #eaf0f4; }
button.primary { background: #245a7c; border-color: #245a7c; color: white; font-weight: 650; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #b77816; outline-offset: 3px;
}
button, select { touch-action: manipulation; }
label { display: grid; min-width: 0; gap: 5px; margin-bottom: 14px; font-weight: 600; }
input, select, textarea { width: 100%; min-width: 0; min-height: 46px; padding: .6em .7em; border: 1px solid #93aebf; border-radius: 7px; background: white; font-weight: 400; }
textarea { resize: vertical; }
h1, h2, p { margin: 0 0 .65em; }
h1 { font: 500 2.05rem/1.17 Georgia, "Times New Roman", serif; color: #1d394e; }
h2 { font-size: 1.28rem; }
small { font-size: .875rem; }
svg { display: block; }
.masthead { color: #fff; background: linear-gradient(112deg, #254a63, #19374f); border-bottom: 2px solid #d5b572; }
.masthead-inner, .tools-inner, .install-help {
  max-width: 1140px; margin: 0 auto;
  padding-inline: max(18px, env(safe-area-inset-left)) max(18px, env(safe-area-inset-right));
}
.masthead-inner, .tools-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; }
.masthead-inner { padding-block: max(13px, env(safe-area-inset-top)) 13px; }
.identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.identity > div { min-width: 0; }
.brand-mark { width: 48px; height: 48px; border: 1px solid #a99868; border-radius: 13px; }
.identity strong { display: block; font: 500 1.65rem/1.13 Georgia, "Times New Roman", serif; }
.identity small { display: block; color: #d6e5ed; font-size: .76rem; margin-top: 3px; }
#account { display: flex; gap: .7em; align-items: center; }
#who { color: #e1eaf0; }
#sign-out { color: #f3f8fa; background: #234158; border-color: #728a9c; font-size: .875rem; }
.office-tools { background: #fafcfd; border-bottom: 1px solid #c9d8e1; }
.tools-inner { padding-block: 5px; }
.reading-control, .stepper { display: inline-flex; align-items: center; }
.reading-control { gap: 10px; flex-wrap: wrap; }
.control-label { color: #39576a; font-size: .875rem; font-weight: 600; }
.stepper { border: 1px solid #acbfcc; border-radius: 9px; background: white; }
.stepper button { border: 0; min-height: 44px; min-width: 44px; padding: 4px 8px; border-radius: 8px; color: #244f6b; font-weight: 700; }
.stepper button:disabled { color: #788995; background: transparent; }
.stepper output { min-width: 3.5em; text-align: center; font-size: .875rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
#install-app, #home-tab { display: inline-flex; gap: .45em; align-items: center; }
#install-app { background: none; color: #2b526a; border-color: transparent; font-size: .875rem; font-weight: 600; padding-inline: 3px; }
#install-app svg, #home-tab svg { width: 1.22em; height: 1.22em; flex-shrink: 0; }
.install-help { padding-block: 8px 14px; font-size: .95rem; }
main { max-width: 1140px; margin: auto; padding: 24px max(18px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
#office-home { max-width: 760px; margin: 0 auto; }
.page-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 5px 12px; margin: 4px 0 15px; }
.page-heading h1 { margin: 0; }
.page-heading time { color: #486075; font-size: .875rem; }
.upload-card {
  position: relative; isolation: isolate; overflow: hidden;
  width: 100%; display: grid; grid-template-columns: minmax(0,1fr) minmax(70px,27%);
  align-items: center; gap: 10px; min-height: 144px; padding: 16px 20px 16px 24px;
  text-align: left; color: #fff; background: linear-gradient(110deg,#234e70 10%,#326a8c 100%);
  border: 1px solid #244d68; border-radius: 15px; box-shadow: 0 3px 9px #243e5219;
}
.upload-card::before, .upload-card::after {
  content: ''; z-index: -1; position: absolute; pointer-events: none; right: -85px; top: -85px;
  width: 268px; height: 268px; border: 1px solid #ffffff20; border-radius: 50%;
}
.upload-card::after { right: -60px; top: -61px; width: 221px; height: 221px; }
.upload-copy, .task-copy { display: grid; min-width: 0; gap: 4px; }
.upload-copy strong { font-size: 1.6rem; line-height: 1.13; font-weight: 660; }
.upload-copy small { color: #ebf2f6; font-size: .94rem; }
.receipt-picture { display: block; justify-self: center; width: 100%; max-width: 134px; height: auto; }
.task-list { margin-top: 16px; border: 1px solid #c4d4de; background: #fff; border-radius: 14px; box-shadow: 0 2px 6px #1e44500b; }
.task { display: grid; width: 100%; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 14px; min-height: 82px; border: 0; border-radius: 0; padding: 14px 18px; text-align: left; }
.task + .task { border-top: 1px solid #d9e4eb; }
.task:first-child { border-radius: 14px 14px 0 0; }
.task:last-child { border-radius: 0 0 14px 14px; }
.task-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 13px; }
.task-icon svg { width: 44px; height: 44px; }
.book { background: #e4eee6; } .phone { background: #e4edf8; } .mail { background: #fcf1d9; }
.task-copy strong { font-size: 1.13rem; font-weight: 650; line-height: 1.2; }
.task-copy small { color: #495f6e; line-height: 1.3; }
.forward { width: 15px; height: 15px; color: #59758a; }
#connect-note { margin-top: 18px; }
.panel, dialog { background: #fff; border: 1px solid #baceda; border-radius: 13px; padding: clamp(14px,3vw,24px); min-width: 0; overflow-wrap: anywhere; }
.login { max-width: 440px; margin: min(5vh,42px) auto; }
.login .primary, #gate-form .primary { width: 100%; }
.columns { display: grid; grid-template-columns: minmax(230px,1fr) minmax(0,2fr); gap: 16px; }
.toolbar, .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar { margin-bottom: 14px; } .toolbar h1 { margin: 0 auto 0 0; } .actions { margin: 10px 0; }
#office-tabs { margin: 0 0 16px; } #office-tabs [aria-pressed="true"] { background: #d9eaf6; border-color: #6e96ac; }
.contacts, .rows { list-style: none; padding: 0; margin: 0; }
.contacts li + li, .rows li + li { margin-top: 8px; }
.contacts button { width: 100%; text-align: left; overflow-wrap: anywhere; }
.contacts button[aria-pressed="true"] { background: #d9ebfa; border-color: #4a83ac; }
.contacts button span { display: block; font-size: .875rem; color: #38576d; }
.rows li { border-top: 1px solid #dce7ef; padding-block: 10px; }
.callbacks { margin-top: 16px; }
.muted { color: #486175; } .notes { white-space: pre-wrap; overflow-wrap: anywhere; } .error { color: #8a322b; } .unread { font-weight: bold; }
dialog { width: min(94vw,520px); max-height: 90dvh; color: inherit; } dialog::backdrop { background: #172e4b80; }
#status, .sync-status { padding: 9px 12px; border-radius: 7px; background: #fdfefe; }
#status { border: 1px solid #bdd1df; }
#mail-message { max-height: 75vh; overflow: auto; }
#mail-list .contacts { max-height: 65vh; overflow: auto; }
#mail-message > button { display: block; margin-block: 8px; overflow-wrap: anywhere; max-width: 100%; }
#books-frame { display: block; width: 100%; height: max(480px, calc(100dvh - 208px)); border: 0; }
body:has(#books-workspace:not([hidden])) main { max-width: none; padding: 8px; }
.books-gate { padding: 0 6px 8px; }
.books-gate #gate { max-width: 580px; margin: 12px auto; }
.books-gate #office-frame { display: block; width: 100%; height: calc(100dvh - 4rem); border: 0; background: white; }
.books-gate .sync-status { font-size: .875rem; margin: 0; }
.books-gate details { padding-top: .7em; } .books-gate summary { cursor: pointer; padding-block: .4em; font-weight: 600; }
.books-gate #empty p { margin-bottom: .4em; }
@media (hover: hover) {
  button:hover:not(:disabled) { background: #e9f2f8; }
  button.primary:hover { background: #1c496a; }
  .upload-card:hover:not(:disabled) { background: linear-gradient(110deg,#1d4668,#2f6383); }
  #sign-out:hover { background: #315b75; }
}
@media (max-width: 660px) {
  .columns { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .contacts { max-height: 225px; overflow: auto; }
  #who { display: none; }
  #office-tabs button:not(#home-tab) { display: none; }
  #office-tabs { margin-bottom: 8px; }
  main { padding-top: 17px; }
  #office-home .upload-card { padding: 15px 13px 15px 18px; min-height: 128px; }
  .task { padding: 12px 14px; gap: 11px; }
  .login { margin-top: 2vh; }
  #books-frame { min-height: 480px; }
}
@media (max-width: 460px) {
  html:is([data-office-size="175"],[data-office-size="200"]) .task { grid-template-columns: 40px minmax(0,1fr); gap: 9px; padding: 13px 10px; }
  html:is([data-office-size="175"],[data-office-size="200"]) .task-icon { width: 40px; height: 44px; }
  html:is([data-office-size="175"],[data-office-size="200"]) .task-icon svg { width: 38px; height: 38px; }
  html:is([data-office-size="175"],[data-office-size="200"]) .forward { display: none; }
  html:is([data-office-size="175"],[data-office-size="200"]) .receipt-picture { max-width: 80px; }
  html:is([data-office-size="175"],[data-office-size="200"]) .upload-card { grid-template-columns: minmax(0,1fr) 62px; }
  html:is([data-office-size="175"],[data-office-size="200"]) .brand-mark { width: 37px; height: 37px; }
}
@media (max-width: 660px) {
  body:has(#books-workspace:not([hidden]), #email-workspace:not([hidden])) #install-app { display: none; }
}
@media (max-width: 460px) {
  html:is([data-office-size="175"],[data-office-size="200"]) .identity small,
  html:is([data-office-size="175"],[data-office-size="200"]) .page-heading time { display: none; }
  html:is([data-office-size="175"],[data-office-size="200"]) .identity strong { font-size: 1.2rem; }
}
