/* TimeBook Mail — an accessible visual layer over Roundcube Elastic.
   Elastic remains the functional base, including responsive behavior and theme switching. */
:root {
  --tb-bg: #f3f6fb;
  --tb-surface: #fff;
  --tb-surface-alt: #f8faff;
  --tb-text: #19263d;
  --tb-muted: #617089;
  --tb-line: #e2e9f3;
  --tb-blue: #1769e8;
  --tb-blue-hover: #0e56ce;
  --tb-blue-soft: #eaf2ff;
  --tb-shadow: 0 10px 35px rgba(31, 67, 121, .08);
  color-scheme: light;
}
html.dark-mode {
  --tb-bg: #0b1220;
  --tb-surface: #111b2b;
  --tb-surface-alt: #172235;
  --tb-text: #edf3fc;
  --tb-muted: #a5b5cb;
  --tb-line: #29384d;
  --tb-blue: #6aa8ff;
  --tb-blue-hover: #91beff;
  --tb-blue-soft: #19365b;
  --tb-shadow: 0 12px 36px rgba(0, 0, 0, .2);
  color-scheme: dark;
}
html.dark-mode #layout { background: var(--tb-bg); }
html.dark-mode #layout-sidebar { background: var(--tb-surface-alt); border-color: var(--tb-line); }
html.dark-mode #layout-list, html.dark-mode #layout-content { background: var(--tb-surface); border-color: var(--tb-line); }
html.dark-mode #layout > div > .header, html.dark-mode #layout > div > .footer { background: var(--tb-surface); border-color: var(--tb-line); color: var(--tb-text); }
html.dark-mode #layout-sidebar .header { background: var(--tb-surface-alt) !important; }
html.dark-mode .searchbar { background: var(--tb-surface-alt); border-color: var(--tb-line); }
html.dark-mode .listing tbody tr, html.dark-mode .listing li { border-color: var(--tb-line); }
html.dark-mode .listing tbody tr:hover, html.dark-mode .listing li:hover { background: var(--tb-surface-alt); }
html.dark-mode .listing tbody tr.selected, html.dark-mode .listing li.selected { background: var(--tb-blue-soft); }
html.dark-mode .form-control, html.dark-mode .custom-select, html.dark-mode input[type="text"], html.dark-mode input[type="email"], html.dark-mode input[type="password"], html.dark-mode textarea { background: var(--tb-surface-alt); border-color: var(--tb-line); color: var(--tb-text); }
html, body, button, input, select, textarea { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { background: var(--tb-bg); color: var(--tb-text); -webkit-font-smoothing: antialiased; }
a { color: var(--tb-blue); }
a:hover { color: var(--tb-blue-hover); }
:is(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--tb-blue) !important;
  outline-offset: 2px;
}

/* Workspace */
#layout { background: var(--tb-bg); }
#layout-menu { background: #10213b; border-right: 0; }
html.dark-mode #layout-menu { background: #0d192b; border-right: 1px solid var(--tb-line); }
#taskmenu { padding-top: 1rem; }
#taskmenu a { border-radius: 13px; margin: .22rem .5rem; transition: background-color .15s ease, color .15s ease; }
#taskmenu a:hover, #taskmenu a.selected { background: rgba(117, 174, 255, .18); }
#taskmenu a.compose { background: #2479f5; color: white; margin-bottom: 1rem; }
#taskmenu a.compose:hover, #taskmenu a.compose.selected { background: #3c8bfb; color: white; }
#layout-menu .popover-header { background: transparent; }
#layout-menu #logo { width: 42px; max-height: 42px; margin: 1rem auto .5rem; }
#layout > div > .header { background: var(--tb-surface); border-color: var(--tb-line); color: var(--tb-text); }
#layout > div > .footer { background: var(--tb-surface); border-color: var(--tb-line); color: var(--tb-muted); }
#layout-sidebar, #layout-list, #layout-content { background: var(--tb-surface); border-color: var(--tb-line); }
#layout-sidebar .header, #layout-list .header, #layout-content .header { min-height: 58px; }
.header-title, #layout-sidebar .username { color: var(--tb-text); font-weight: 700; letter-spacing: -.015em; }
#layout-sidebar { background: var(--tb-surface-alt); }
#layout-sidebar .header { background: var(--tb-surface-alt) !important; }
#folderlist-content { padding: .55rem .5rem; }
#mailboxlist li a { border-radius: 10px; margin: 2px 0; color: var(--tb-muted); }
#mailboxlist li.selected > a, #mailboxlist li a:hover { background: var(--tb-blue-soft); color: var(--tb-blue); }
#mailboxlist li.selected > a { font-weight: 650; }
#mailboxlist .unreadcount { background: var(--tb-blue); color: white; border-radius: 999px; }
.searchbar { background: var(--tb-surface-alt); border-color: var(--tb-line); }
.searchbar input { background: transparent; color: var(--tb-text); }
.searchbar input::placeholder { color: var(--tb-muted); }

/* Message lists and reading */
.listing tbody tr, .listing li { border-color: var(--tb-line); }
.listing tbody tr:hover, .listing li:hover { background: var(--tb-surface-alt); }
.listing tbody tr.selected, .listing li.selected { background: var(--tb-blue-soft); }
.messagelist td { padding-top: .65rem; padding-bottom: .65rem; }
.messagelist tr.unread .subject, .messagelist tr.unread .fromto { color: var(--tb-text); font-weight: 700; }
.messagelist .subject, .messagelist .fromto { color: var(--tb-text); }
.messagelist .date, .messagelist .size { color: var(--tb-muted); }
#message-header .subject { color: var(--tb-text); letter-spacing: -.025em; }
.message-part { color: var(--tb-text); }
.toolbar a.button:hover, .toolbar a.button:focus-visible { background: var(--tb-blue-soft); color: var(--tb-blue); border-radius: 9px; }

/* Forms, composer, dialogs, settings */
.form-control, .custom-select, input[type="text"], input[type="email"], input[type="password"], textarea {
  border-color: var(--tb-line); background-color: var(--tb-surface); color: var(--tb-text); border-radius: 10px;
}
.form-control:focus, .custom-select:focus, textarea:focus {
  border-color: var(--tb-blue); box-shadow: 0 0 0 3px var(--tb-blue-soft);
}
.btn-primary, .formbuttons .button.mainaction, .formbuttons button.mainaction {
  background: #1769e8; border-color: #1769e8; color: white; border-radius: 10px; font-weight: 650;
}
.btn-primary:hover, .formbuttons .button.mainaction:hover, .formbuttons button.mainaction:hover {
  background: #0e56ce; border-color: #0e56ce; color: white;
}
.btn-secondary, .btn-outline-secondary { border-radius: 10px; }
.propform .form-group, .propform .row { color: var(--tb-text); }
.propform label, .proplist label { color: var(--tb-muted); font-weight: 550; }
.popupmenu, .popover, .ui-dialog, .modal-content { background: var(--tb-surface); color: var(--tb-text); border-color: var(--tb-line); box-shadow: var(--tb-shadow); border-radius: 14px; }
.popupmenu a, .popover a { color: var(--tb-text); }
.popupmenu a:hover, .popover a:hover { background: var(--tb-blue-soft); color: var(--tb-blue); }
.ui-dialog-titlebar, .modal-header { background: var(--tb-surface-alt); border-color: var(--tb-line); }
.listing.iconized li.selected, .listing.iconized li:hover { background: var(--tb-blue-soft); }
.navlist a.selected { color: var(--tb-blue); border-color: var(--tb-blue); }
.attachmentlist { background: var(--tb-surface-alt); border-color: var(--tb-line); border-radius: 12px; }

/* Login — a distinct TimeBook welcome screen without altering authentication. */
.task-login #layout { background: var(--tb-bg); }
.task-login #layout-content { display: block; height: 100%; padding: 0; overflow: auto; background: var(--tb-bg); text-align: left; }
.timebook-login-shell { display: grid; grid-template-columns: minmax(420px, 47%) 1fr; min-height: 100vh; }
.timebook-login-story {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  padding: clamp(30px, 5vw, 78px); overflow: hidden; color: white;
  background: radial-gradient(circle at 80% 22%, rgba(91, 213, 255, .56), transparent 30%), linear-gradient(145deg, #063fbc 0%, #1169f4 52%, #55c6ee 100%);
}
.timebook-login-story::after {
  content: ""; position: absolute; width: 680px; height: 680px; right: -240px; bottom: -340px;
  border: 1px solid rgba(255,255,255,.35); border-radius: 50%; box-shadow: 0 0 0 88px rgba(255,255,255,.06), 0 0 0 180px rgba(255,255,255,.04);
  pointer-events: none;
}
.timebook-story-brand { display: flex; align-items: center; gap: 13px; font-size: 23px; font-weight: 750; letter-spacing: -.045em; z-index: 1; }
.timebook-story-brand img { width: 44px; height: 44px; }
.timebook-story-brand b { font-weight: 450; opacity: .88; }
.timebook-story-copy { z-index: 1; max-width: 570px; }
.timebook-eyebrow { display: block; font-size: 11px; font-weight: 750; letter-spacing: .17em; }
.timebook-story-copy .timebook-eyebrow { color: #d5eaff; }
.timebook-story-copy h2 { margin: 18px 0 20px; color: white; font-size: clamp(40px, 4vw, 64px); font-weight: 700; line-height: 1.08; letter-spacing: -.055em; }
.timebook-story-copy p { max-width: 470px; color: #e5f1ff; font-size: 17px; line-height: 1.65; }
.timebook-story-footer { z-index: 1; font-size: 13px; letter-spacing: .08em; color: #d6e9ff; }
.timebook-login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 42px 30px; }
.timebook-login-card { width: min(100%, 420px); }
.task-login #logo { position: static; display: block; width: 104px; max-height: none; height: auto; margin: 0 0 40px; opacity: 1; }
.timebook-login-intro .timebook-eyebrow { color: var(--tb-blue); }
.timebook-login-intro h2 { margin: 11px 0 9px; color: var(--tb-text); font-size: 34px; font-weight: 720; letter-spacing: -.045em; }
.timebook-login-intro p { margin: 0 0 30px; color: var(--tb-muted); font-size: 15px; }
#login-form { position: static; width: 100%; max-width: none; margin: 0; }
#login-form .form-control { min-height: 50px; padding: 11px 14px; font-size: 16px; }
#login-form .formbuttons button, #login-form .formbuttons .button { width: 100%; min-height: 50px; border-radius: 11px; margin-top: 14px; font-size: 15px; }
#login-footer { margin-top: 30px; color: var(--tb-muted); font-size: 12px; }
#login-footer > div { background: var(--tb-surface-alt); border-radius: 10px; }
.timebook-login-note { margin: 42px 0 0; color: var(--tb-muted); font-size: 12px; text-align: center; }

@media (max-width: 850px) {
  .timebook-login-shell { grid-template-columns: 1fr; }
  .timebook-login-story { min-height: 215px; padding: 26px; }
  .timebook-story-copy { display: none; }
  .timebook-story-footer { display: none; }
  .timebook-login-panel { min-height: calc(100vh - 215px); padding: 36px 24px; }
  .task-login #logo { margin-bottom: 34px; }
}
@media (max-width: 480px) {
  .timebook-login-story { min-height: 118px; padding: 22px 24px; }
  .timebook-login-panel { min-height: calc(100vh - 118px); justify-content: flex-start; padding-top: 36px; }
  .timebook-login-intro h2 { font-size: 29px; }
  .task-login #logo { width: 88px; margin-bottom: 26px; }
  #taskmenu a { margin-left: .25rem; margin-right: .25rem; }
}
@media (prefers-reduced-motion: reduce) {
  #taskmenu a { transition: none; }
}
