/* Application behavior and responsive additions to the supplied visual design. */
[hidden] { display: none !important; }
:root { color-scheme: light; --header-h: 58px; }
[data-theme="dark"] { color-scheme: dark; }
body { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .45; }
button:disabled:hover { transform: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; box-shadow: none;
}
select, input, textarea { color: var(--text); }
a { color: var(--accent-text); }
svg { width: 20px; height: 20px; flex-shrink: 0; }
#root { height: 100%; }
.app { height: 100vh; height: 100dvh; }
.loading-screen { min-height: 100vh; display: grid; place-items: center; color: var(--text-2); }
.no-script { padding: 24px; background: var(--surface); position: fixed; inset: 0; z-index: 100; }
.skip-link { position: fixed; left: 12px; top: -100px; z-index: 100; padding: 12px 18px; background: var(--surface); border: 2px solid var(--accent); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.workspace-shell { display: flex; flex: 1; min-width: 0; flex-direction: column; }
.workspace-header { min-height: var(--header-h); flex: 0 0 var(--header-h); padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.workspace-brand { flex: 1; overflow: hidden; }
.header-account { flex-shrink: 0; }
.workspace-brand, .header-account { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 650; letter-spacing: -.025em; font-size: 17px; white-space: nowrap; }
.header-divider { width: 1px; height: 19px; background: var(--border); }
.preview-badge { display: inline-block; flex-shrink: 0; font-size: 10px; font-weight: 500; line-height: 1.4; color: var(--accent-text); background: var(--accent-soft); border-radius: 20px; padding: 3px 8px; }
.login-brand .preview-badge { margin: 8px 0 4px; }
.workspace-title { font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.account-name { color: var(--text-2); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 230px; }
.header-account .icon-btn { display: none; }
.workspace { min-height: 0; flex: 1; display: flex; outline: none; }
.rail { padding-top: 10px; }
.rail-label { display: none; }
.rail-avatar .avatar { width: 32px; height: 32px; }
.avatar { background: var(--accent-soft); color: var(--accent-text); flex-shrink: 0; }
.read-empty { padding: 32px 20px; min-height: 150px; }
.read-empty p { max-width: 260px; color: var(--text-2); }
.error-box { padding: 14px 16px; margin: 12px; background: var(--red-soft); color: var(--red-text); border-radius: var(--r-m); overflow-wrap: anywhere; font-size: 13px; }
.error-box .btn { margin-top: 12px; }
.error-box p { white-space: pre-wrap; }
.text-content { white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; }
.actions { display: flex; align-items: center; gap: 8px; }
.load-more { align-self: center; margin: 16px auto; display: flex; }
.mail-module { display: flex; flex-direction: column; min-width: 0; width: 100%; min-height: 0; }
.mail-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--border); background: var(--bg); }
.mail-folder-heading { min-width: 0; flex: 1; }
.mail-toolbar > .actions { flex-shrink: 0; }
.folder-title { font-size: 17px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.folder-select { display: none; width: 100%; max-width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px; font: inherit; }
.mail-columns { display: flex; min-height: 0; flex: 1; }
.folder-list { overflow-y: auto; }
.folder { min-height: 39px; }
.folder-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-folders { flex-basis: 205px; }
.pane-folders .pane-foot { overflow-wrap: anywhere; font-size: 10px; color: var(--text-3); }
.pane-folders .side-title { padding: 0 4px; }
.mail-columns .pane-list { flex-basis: 335px; }
.mail-list { display: flex; flex-direction: column; overflow-y: auto; flex: 1; }
.mail-item { text-align: left; width: 100%; flex-shrink: 0; min-height: 92px; padding: 13px 16px; }
.mail-subject, .mail-snippet { display: block; }
.mail-from { min-width: 0; }
.mail-time { font-size: 10px; }
.mail-flag { position: absolute; bottom: 12px; right: 12px; color: var(--accent-text); }
.mail-flag svg { width: 14px; height: 14px; }
.mail-item.flagged .mail-attachment-indicator { right: 32px; }
.mail-item.flagged .mail-snippet { padding-right: 34px; }
.folder-manager-actions { flex-wrap: wrap; margin: 10px 0 20px; }
.mail-attachment-indicator { position: absolute; bottom: 12px; right: 12px; color: var(--text-3); }
.mail-attachment-indicator svg { width: 12px; height: 12px; }
.mail-item:has(.mail-attachment-indicator) .mail-snippet { padding-right: 14px; }
.mail-item.flagged:has(.mail-attachment-indicator) .mail-snippet { padding-right: 52px; }
.read-head { min-height: 55px; flex-wrap: wrap; }
.reading-back { flex: none; }
.read-meta { flex-wrap: wrap; gap: 12px; }
.read-meta > div { min-width: 0; }
.read-to { overflow-wrap: anywhere; }
.read-subject { overflow-wrap: anywhere; }
.read-text { margin-top: 28px; font-size: 14px; line-height: 1.85; }
.mail-body-content { margin-top: 24px; }
.mail-body-switch { display: flex; flex-wrap: wrap; gap: 6px; }
.mail-body-switch .btn { font-size: 11px; padding: 5px 9px; }
.mail-body-switch .is-on { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.mail-body-notice { font-size: 11px; color: var(--text-2); padding: 12px 0; }
.mail-html-frame { width: 100%; height: 54vh; min-height: 260px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); display: block; }
.mail-links { margin-top: 14px; font-size: 12px; overflow-wrap: anywhere; }
.mail-links summary { cursor: pointer; color: var(--text-2); }
.mail-links ul { padding: 12px 0 0 18px; }
.mail-links li { padding: 7px 0; }
.mail-links .mono { display: block; font-size: 10px; color: var(--text-2); margin-top: 2px; }
.read-date { margin-left: auto; }
.attach { text-decoration: none; overflow-wrap: anywhere; max-width: 100%; }
.attach span:first-of-type { min-width: 0; }
.attach-row { margin-top: 28px; flex-wrap: wrap; }
.resource-module { display: flex; flex-direction: column; width: 100%; min-height: 0; background: var(--surface); }
.resource-toolbar { flex-shrink: 0; gap: 12px; padding-bottom: 14px; }
.resource-toolbar h2 { font-size: 20px; }
.resource-search { padding: 0 28px 18px; }
.resource-search .search { max-width: 430px; }
.resource-content { display: flex; min-height: 0; flex: 1; border-top: 1px solid var(--border); }
.resource-list { flex: 0 0 350px; min-width: 0; overflow-y: auto; padding: 12px 0 24px; }
.resource-detail { flex: 1; overflow-y: auto; border-left: 1px solid var(--border); min-width: 0; }
.resource-detail > .read-empty { height: 100%; }
.resource-detail .read-head { position: sticky; top: 0; z-index: 2; background: var(--surface); }
.detail-head > svg { height: 38px; width: 38px; color: var(--accent-text); margin-bottom: 14px; }
.detail-head h2 { overflow-wrap: anywhere; }
.detail-wrap { padding: 35px 26px; }
.dfield { align-items: flex-start; }
.dfield .v { min-width: 0; margin: 0; }
.contact-item { width: 100%; text-align: left; min-height: 61px; }
.resource-notes .resource-list { flex-basis: 48%; }
.resource-notes .notes-grid { columns: 2 190px; padding: 20px; }
.resource-notes .note { text-align: left; display: inline-block; width: 100%; }
.resource-notes .note p { max-height: 160px; overflow: hidden; overflow-wrap: anywhere; }
.resource-tasks .resource-list { flex-basis: 48%; padding: 16px 24px; }
.resource-tasks .task { gap: 10px; padding: 14px 0; }
.task-open { min-width: 0; flex: 1; display: flex; align-items: center; gap: 12px; text-align: left; }
.task-title { flex: 1; overflow-wrap: anywhere; }
.task-due { flex: none; font-size: 10px; }
.task-check { flex: none; }
.task-check svg { width: 14px; height: 14px; }
.resource-calendar .resource-content { flex-direction: column; }
.resource-calendar .resource-list { flex: 1; padding: 18px 24px; }
.resource-calendar .resource-detail { display: none; }
.resource-calendar.has-detail .resource-list { display: none; }
.resource-calendar.has-detail .resource-detail { display: block; }
.cal-toolbar { flex-wrap: wrap; gap: 16px; padding: 10px 28px 18px; }
.cal-title { font-size: 14px; font-weight: 600; }
.calendar-cards { display: grid; gap: 12px; }
.calendar-week, .calendar-month { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-day { border: 1px solid var(--border); border-radius: 10px; background: var(--bg); min-height: 180px; padding: 9px; min-width: 0; }
.calendar-day.is-today { border-color: var(--accent); }
.calendar-day h4 { font-size: 11px; margin-bottom: 15px; color: var(--text-2); font-weight: 600; }
.calendar-day.is-today h4 { color: var(--accent-text); }
.calendar-event { display: flex; flex-direction: column; gap: 5px; border-radius: 7px; padding: 10px; background: var(--blue-soft); color: var(--blue-text); width: 100%; text-align: left; margin: 6px 0; overflow-wrap: anywhere; }
.calendar-event strong { font-size: 12px; font-weight: 550; }
.calendar-event span, .calendar-event small { font-size: 10px; }
.day-empty { font-size: 11px; color: var(--text-3); }
.native-dialog { margin: auto; max-height: calc(100dvh - 36px); padding: 0; color: var(--text); max-width: calc(100vw - 32px); }
.native-dialog::backdrop { background: rgb(0 0 0 / .35); backdrop-filter: blur(4px); }
.native-dialog.wide-dialog { width: min(740px, 100%); }
.native-dialog .compose-head h2 { font-size: 14px; font-weight: 600; }
.native-dialog .dialog-body { max-height: calc(100dvh - 225px); }
.native-dialog .dialog-errors:empty { display: none; }
.native-dialog .dialog-errors { max-height: 150px; overflow: auto; }
.native-dialog .dialog-errors .error-box { margin-bottom: 0; }
.native-dialog .compose-foot { gap: 12px; }
.native-dialog .compose-foot .actions { flex-wrap: wrap; }
.native-dialog .f-row input[type="datetime-local"] { font-family: inherit; flex: 1; min-width: 0; background: none; border: 0; color: var(--text); padding: 4px 0; }
.native-dialog .f-row input[type="file"] { flex: 1; min-width: 0; max-width: 100%; font-size: 12px; }
.native-dialog .f-row input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; }
.native-dialog .f-row { padding: 13px 0; }
.native-dialog .f-row > label { color: var(--text-2); }
.f-row-textarea { align-items: flex-start; }
.native-dialog .wide-dialog textarea, .wide-dialog textarea { min-height: 210px; }
.form-help { color: var(--text-2); font-size: 12px; padding: 12px 0; }
.confirm-message { padding: 20px 0; overflow-wrap: anywhere; }
.account-card { padding: 20px 0; text-align: center; overflow-wrap: anywhere; }
.account-card .avatar { margin: 0 auto 14px; width: 52px; height: 52px; }
.account-card p { margin-top: 8px; color: var(--text-2); }
.login-wrap { min-height: 100vh; min-height: 100dvh; }
.login-submit { margin-top: 22px; min-height: 44px; }
.login-feedback .error-box { margin: 12px 0 0; }
.login-foot { flex-wrap: wrap; justify-content: center; }
.login-brand h1 { overflow-wrap: anywhere; }
.category-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 20px; }
.category-chip { max-width: 100%; overflow-wrap: anywhere; font-size: 11px; padding: 4px 9px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-text); }
.login-card input { font-size: 16px; }
.toast { max-width: calc(100vw - 30px); text-align: center; width: max-content; border-radius: 12px; }
@media (max-width: 1250px) {
  .pane-folders { flex-basis: 180px; }
  .mail-columns .pane-list { flex-basis: 300px; }
  .read-body { padding: 25px 25px 45px; }
  .calendar-week, .calendar-month { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .resource-list { flex-basis: 310px; }
}
@media (max-width: 1020px) {
  .mail-columns .pane-folders { display: none; }
  .folder-title { display: none; }
  .folder-select { display: block; }
  .resource-tasks .task-open { flex-direction: column; align-items: flex-start; gap: 4px; }
}
@media (max-width: 760px) {
  :root { --header-h: 55px; }
  .app { flex-direction: column-reverse; }
  .rail { width: 100%; flex: 0 0 auto; flex-direction: row; justify-content: space-around; padding: 5px 5px calc(5px + env(safe-area-inset-bottom)); gap: 0; border-right: 0; border-top: 1px solid var(--border); z-index: 10; }
  .rail .rail-logo, .rail .rail-spacer, .rail .rail-utility { display: none; }
  .rail-btn { width: auto; flex: 1; max-width: 90px; height: 49px; display: flex; flex-direction: column; justify-content: center; gap: 3px; border-radius: 8px; }
  .rail-btn svg { width: 20px; height: 20px; }
  .rail-label { display: block; font-size: 10px; line-height: 1.1; }
  .workspace-shell { min-height: 0; }
  .workspace-header { padding: 0 15px; }
  .header-account { gap: 5px; }
  .header-account .icon-btn { display: inline-grid; }
  .account-name { display: none; }
  .workspace-brand { gap: 10px; }
  .brand-name { font-size: 16px; }
  .workspace-header .preview-badge { font-size: 9px; padding: 2px 6px; }
  .workspace-title { font-size: 12px; }
  .mail-toolbar { padding: 11px 13px; }
  .mail-toolbar .actions { gap: 3px; }
  .mail-toolbar .btn { padding: 9px 10px; font-size: 12px; }
  .folder-select { max-width: 180px; font-size: 12px; }
  .mail-columns .pane-list { flex: 1; }
  .mail-columns .pane-reading { display: none; }
  .mail-module.has-selection .pane-list { display: none; }
  .mail-module.has-selection .pane-reading { display: flex; }
  .mail-item { min-height: 103px; padding: 16px 18px; }
  .mail-from { font-size: 14px; }
  .mail-subject { font-size: 14px; margin-top: 4px; }
  .mail-snippet { font-size: 12px; }
  .mail-time { font-size: 10px; }
  .read-head { padding: 10px 12px; gap: 3px; }
  .read-head .icon-btn { width: 34px; height: 34px; }
  .read-body { padding: 25px 20px 40px; }
  .read-subject { font-size: 23px; }
  .read-date { margin-left: 0; width: 100%; }
  .resource-toolbar { padding: 18px 16px 14px; }
  .resource-toolbar h2 { font-size: 18px; }
  .resource-toolbar .btn { padding: 9px 10px; font-size: 12px; }
  .resource-toolbar .actions { gap: 4px; }
  .resource-search { padding: 0 16px 16px; }
  .resource-search .search { max-width: none; }
  .resource-content { display: block; overflow: hidden; }
  .resource-list, .resource-notes .resource-list, .resource-tasks .resource-list { height: 100%; width: 100%; }
  .resource-detail { display: none; height: 100%; border-left: 0; }
  .resource-module.has-detail .resource-list { display: none; }
  .resource-module.has-detail .resource-detail { display: block; }
  .resource-notes .notes-grid { columns: 2 150px; padding: 16px; }
  .resource-tasks .resource-list { padding: 14px 18px; }
  .resource-tasks .task-open { flex-direction: row; align-items: center; gap: 8px; }
  .task-check { width: 26px; height: 26px; }
  .detail-wrap { padding: 24px 18px; }
  .dfield { gap: 12px; padding: 12px; }
  .dfield .k { flex-basis: 80px; }
  .contact-item { min-height: 72px; }
  .cal-toolbar { padding: 0 16px 16px; gap: 12px; }
  .cal-title { order: 3; flex-basis: 100%; }
  .resource-calendar .resource-list { padding: 15px; }
  .calendar-week, .calendar-month { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar-day { min-height: 130px; }
  .calendar-day h4 { font-size: 12px; }
  .native-dialog { max-width: calc(100vw - 20px); max-height: calc(100dvh - 20px); border-radius: 14px; }
  .native-dialog .dialog-body { max-height: calc(100dvh - 215px); padding: 8px 16px; }
  .native-dialog .compose-head, .native-dialog .compose-foot { padding: 13px 16px; }
  .native-dialog .f-row { align-items: stretch; flex-direction: column; gap: 7px; }
  .native-dialog .f-row > label { flex: 0 0 auto; }
  .native-dialog .f-row input, .native-dialog .f-row textarea, .native-dialog .f-row select { font-size: 16px; width: 100%; }
  .native-dialog .f-row input[type="checkbox"] { width: 20px; }
  .native-dialog .compose-foot .btn { font-size: 12px; }
  .native-dialog .dialog-errors { max-height: 120px; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
  .workspace-title, .header-divider { display: none; }
  .folder-select { max-width: 140px; }
  .mail-toolbar .actions > .icon-btn { width: 30px; flex-shrink: 0; }
  .calendar-week, .calendar-month { grid-template-columns: 1fr; }
  .login-card { padding: 28px 23px; }
  .login-card .f-row { flex-direction: column; align-items: stretch; gap: 7px; }
  .login-card .f-row > label { flex-basis: auto; }
  .login-card .f-pair { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
