/*
 * Workio theme for Roundcube Elastic.
 * Colours mirror the Workio admin (src/app/globals.css): neutral greys,
 * near-black primary, blue only for links and focus, Inter, 8px radius.
 */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

/* Workio's own Georgian font (same files as workio.ge), Georgian glyphs only */
@font-face {
  font-family: "WorkioGeorgian";
  src: url("fonts/Regular.woff2") format("woff2");
  font-weight: 300 400;
  font-display: swap;
  unicode-range: U+10A0-10FF, U+1C90-1CBF, U+2D00-2D2F;
}

@font-face {
  font-family: "WorkioGeorgian";
  src: url("fonts/Medium.woff2") format("woff2");
  font-weight: 500 600;
  font-display: swap;
  unicode-range: U+10A0-10FF, U+1C90-1CBF, U+2D00-2D2F;
}

@font-face {
  font-family: "WorkioGeorgian";
  src: url("fonts/Bold.woff2") format("woff2");
  font-weight: 700 900;
  font-display: swap;
  unicode-range: U+10A0-10FF, U+1C90-1CBF, U+2D00-2D2F;
}

:root {
  --w-bg: #FFFFFF;
  --w-sidebar: #FAFAFA;
  --w-card: #FFFFFF;
  --w-fg: #0A0A0A;
  --w-muted-fg: #737373;
  --w-border: #E5E5E5;
  --w-hover: rgba(0, 0, 0, 0.04);
  --w-active: #F0F0F0;
  --w-selected: #EBEBEB;
  --w-primary: #171717;
  --w-primary-fg: #FAFAFA;
  --w-primary-hover: #2A2A2A;
  --w-link: #0066FF;
  --w-ring: rgba(0, 102, 255, 0.35);
  --w-input: #FFFFFF;
  --w-input-border: #E5E5E5;
  --w-badge: #171717;
  --w-badge-fg: #FFFFFF;
  --w-danger: #E7000B;
  --w-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 8px 24px -6px rgba(0, 0, 0, 0.12);
  --w-radius: 8px;
  --w-font: "Inter", "WorkioGeorgian", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html.dark-mode {
  --w-bg: #191919;
  --w-sidebar: #1F1F1F;
  --w-card: #1F1F1F;
  --w-fg: #EDEDED;
  --w-muted-fg: #9C9C9C;
  --w-border: rgba(255, 255, 255, 0.08);
  --w-hover: rgba(255, 255, 255, 0.04);
  --w-active: #2A2A2A;
  --w-selected: #2E2E2E;
  --w-primary: #EDEDED;
  --w-primary-fg: #191919;
  --w-primary-hover: #FFFFFF;
  --w-link: #6AABF1;
  --w-ring: rgba(37, 125, 224, 0.6);
  --w-input: #232323;
  --w-input-border: rgba(255, 255, 255, 0.12);
  --w-badge: #257DE0;
  --w-badge-fg: #FFFFFF;
  --w-danger: #F17778;
  --w-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 12px 32px -8px rgba(0, 0, 0, 0.6);
}

/* ---------- Base ---------- */
html:root:root body,
html:root:root body .form-control,
html:root:root body .custom-select,
html:root:root body input,
html:root:root body select,
html:root:root body textarea,
html:root:root body button,
html:root:root body .btn,
html:root:root body .popover,
html:root:root body .ui-dialog,
html:root:root body .ui-widget {
  font-family: var(--w-font);
}

html:root:root body {
  background-color: var(--w-bg);
  color: var(--w-fg);
  -webkit-font-smoothing: antialiased;
}

html:root:root body a,
html:root:root body .link {
  color: var(--w-link);
}

html:root:root body .text-muted,
html:root:root body .hint,
html:root:root body .voice + .hint {
  color: var(--w-muted-fg) !important;
}

/* ---------- Left app menu (like the admin sidebar) ---------- */
html:root:root #layout-menu {
  background-color: var(--w-sidebar);
  border-right: 1px solid var(--w-border);
  color: var(--w-fg);
}

html:root:root #layout-menu .popover-header {
  background: transparent !important;
  border: 0;
}

html:root:root #layout-menu #logo {
  max-width: 40px;
  max-height: 34px;
  margin: 1rem auto .75rem;
}

html.dark-mode:root:root #logo,
html.dark-mode:root:root .watermark-logo {
  filter: invert(1) brightness(0.93);
}

html:root:root #taskmenu a,
html:root:root #taskmenu .special-buttons a {
  color: var(--w-muted-fg);
  border: 0;
  border-radius: var(--w-radius);
  width: auto;
  margin: 2px 8px;
  font-size: 0.72rem;
  font-weight: 500;
  transition: background-color .15s, color .15s;
}

html:root:root #taskmenu a:not(.selected):not(.compose),
html:root:root #layout-menu .special-buttons,
html:root:root #layout-menu .special-buttons a:not(.selected) {
  background-color: transparent;
}

html:root:root #taskmenu a:hover {
  background-color: var(--w-hover);
  color: var(--w-fg);
}

html:root:root #taskmenu a.selected,
html:root:root #taskmenu a.selected:hover {
  background-color: var(--w-selected);
  color: var(--w-fg);
}

/* Compose = primary action */
html:root:root #taskmenu a.compose,
html:root:root #taskmenu a.compose:hover {
  background-color: var(--w-primary);
  color: var(--w-primary-fg);
  margin: 4px 8px 10px;
}

html:root:root #taskmenu a.compose:hover {
  background-color: var(--w-primary-hover);
}

html:root:root #taskmenu a.compose.disabled {
  opacity: .5;
}

html:root:root #taskmenu a.logout,
html:root:root #taskmenu a.logout:hover {
  color: var(--w-danger);
}

/* ---------- Panels and headers ---------- */
html:root:root #layout-sidebar,
html:root:root #layout-list,
html:root:root #layout-content,
html:root:root .sidebar,
html:root:root .content,
html:root:root .listbox {
  background-color: var(--w-bg);
  border-color: var(--w-border);
}

html:root:root #layout-sidebar {
  background-color: var(--w-sidebar);
}

html:root:root #layout-sidebar,
html:root:root #layout-list {
  border-right: 1px solid var(--w-border);
}

html:root:root .header,
html:root:root #layout-sidebar > .header,
html:root:root #layout-list > .header,
html:root:root #layout-content > .header,
html:root:root .header-title {
  background-color: transparent;
  border-color: var(--w-border);
  color: var(--w-fg);
}

html:root:root .header-title,
html:root:root #layout-sidebar > .header .header-title {
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: -0.01em;
}

html:root:root .footer,
html:root:root #layout-list > .footer,
html:root:root #layout-sidebar > .footer {
  background-color: transparent;
  border-color: var(--w-border);
}

html:root:root .formbuttons,
html:root:root .formcontent,
html:root:root .formcontainer {
  background-color: transparent;
}

/* ---------- Toolbars ---------- */
html:root:root .toolbar a,
html:root:root .toolbar .dropbutton,
html:root:root .toolbar a.button {
  color: var(--w-fg);
  border-radius: var(--w-radius);
  font-weight: 500;
}

html:root:root .toolbar a:not(.disabled):hover,
html:root:root .toolbar a.button:not(.disabled):hover {
  background-color: var(--w-hover);
  color: var(--w-fg);
}

html:root:root .toolbar a.disabled,
html:root:root .toolbar a.button.disabled {
  color: var(--w-muted-fg);
  opacity: .45;
}

html:root:root .toolbar a.selected {
  background-color: var(--w-selected);
}

/* ---------- Folder list and other side listings ---------- */
html:root:root .listing li,
html:root:root .listing li > a,
html:root:root ul.listing li a,
html:root:root #mailboxlist li a,
html:root:root table.listing td {
  color: var(--w-fg);
  border-color: transparent;
}

html:root:root #mailboxlist li > a,
html:root:root #settings-menu li > a,
html:root:root #directorylist li > a,
html:root:root #addressbooks-table li > a {
  border-radius: var(--w-radius);
  margin: 1px 8px;
  padding-left: .75rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  transition: background-color .12s;
}

html:root:root #mailboxlist li > a:before,
html:root:root #settings-menu li > a:before,
html:root:root #directorylist li > a:before,
html:root:root #addressbooks-table li > a:before {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: none;
}

/* Row icons: let the icon box match the row's line height so it centres */
html:root:root table.listing td.name:before,
html:root:root .listing li a:before {
  height: auto;
}

/* ---------- Search bar: one rounded field with icons inside ---------- */
html:root:root #layout-list > .searchbar {
  margin: 6px 12px 10px;
  width: auto;
  height: 38px;
  background: var(--w-input);
  border: 1px solid var(--w-input-border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  padding: 0 4px 0 10px;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}

html:root:root #layout-list > .searchbar:focus-within {
  border-color: var(--w-link);
  box-shadow: 0 0 0 3px var(--w-ring);
}

html:root:root #layout-list > .searchbar form {
  flex: 1;
  min-width: 0;
  display: flex;
  margin: 0;
}

html:root:root #layout-list > .searchbar form:before {
  display: none;
}

html:root:root #layout-list > .searchbar input,
html:root:root #layout-list > .searchbar input:focus {
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  height: 36px;
  padding: 0 6px;
  flex: 1;
  min-width: 0;
  position: static;
}

html:root:root #layout-list > .searchbar a.button {
  position: static;
  width: 30px;
  height: 30px;
  line-height: 30px;
  border-radius: 7px;
  color: var(--w-muted-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  margin: 0;
}

html:root:root #layout-list > .searchbar a.button:hover {
  background: var(--w-hover);
  color: var(--w-fg);
}

html:root:root #layout-list > .searchbar a.button:before {
  width: 18px;
  height: 18px;
  line-height: 18px;
  margin: 0;
}

html:root:root #layout-list > .searchbar a.button .inner {
  display: none;
}

html:root:root #layout-list > .searchbar a.button.search {
  order: -1;
  width: 20px;
}

html:root:root #layout-list > .searchbar:has(input:placeholder-shown) a.button.reset {
  display: none;
}

html:root:root #mailboxlist li > a:hover,
html:root:root #settings-menu li > a:hover,
html:root:root #directorylist li > a:hover {
  background-color: var(--w-hover);
}

html:root:root .listing li.selected > a,
html:root:root .listing li.selected > div > a,
html:root:root #mailboxlist li.selected > a,
html:root:root #settings-menu li.selected > a,
html:root:root #directorylist li.selected > a {
  background-color: var(--w-selected) !important;
  color: var(--w-fg) !important;
  font-weight: 600;
}

html:root:root .listing li.selected,
html:root:root .listing li.selected > a:before,
html:root:root .listing li > a:before,
html:root:root .listing li.droptarget > a {
  color: inherit;
  background-color: transparent;
}

html:root:root .listing li.droptarget > a {
  background-color: var(--w-active) !important;
}

html:root:root .listing li .unreadcount,
html:root:root .listing li .count,
html:root:root .badge,
html:root:root .badge-info {
  background-color: var(--w-badge);
  color: var(--w-badge-fg);
  border-radius: 999px;
  font-weight: 600;
  min-width: 1.5em;
  text-align: center;
}

html:root:root #mailboxlist li.unread > a {
  font-weight: 600;
}

/* Quota bar */
html:root:root .quota-widget .bar {
  background-color: var(--w-active);
  border-radius: 999px;
  border: 0;
  overflow: hidden;
}

html:root:root .quota-widget .bar .value {
  background-color: var(--w-fg);
}

/* ---------- Message list / tables ---------- */
html:root:root table.listing,
html:root:root table.listing tbody tr,
html:root:root table.listing tr td {
  background-color: transparent;
  color: var(--w-fg);
  border-color: var(--w-border);
}

html:root:root table.listing tbody tr td {
  border-bottom: 1px solid var(--w-border);
}

html:root:root table.listing tbody tr:hover td {
  background-color: var(--w-hover);
}

html:root:root table.listing tr.selected td,
html:root:root table.listing tr.selected:hover td {
  background-color: var(--w-selected) !important;
  color: var(--w-fg) !important;
}

/* Keyboard-focus indicator: neutral instead of Elastic's cyan */
html:root:root .listing.focus tbody tr.focused > td:first-child,
html:root:root .listing.focus tbody tr.focused > td.selection + td,
html:root:root .listing li > a:focus {
  border-left-color: var(--w-fg);
}

html:root:root table.listing tr.focused {
  outline: 0;
}

/* Subject links keep the text colour (Elastic paints them blue) */
html:root:root table.listing tr td span.subject a,
html:root:root table.listing tr td span.subject a span,
html:root:root table.listing tr.selected td a {
  color: var(--w-fg) !important;
}

html:root:root table.listing tr.unread td,
html:root:root table.listing tr.unread td span.subject,
html:root:root table.listing tr.unread td span.subject a {
  font-weight: 600;
  color: var(--w-fg);
}

html:root:root table.listing tr td span.date,
html:root:root table.listing tr td span.size,
html:root:root table.listing tr td.date,
html:root:root table.listing tr:not(.unread) td span.fromto,
html:root:root table.listing td .fromto .adr {
  color: var(--w-muted-fg);
}

html:root:root table.listing tr.unread td span.fromto,
html:root:root table.listing tr.unread td span.fromto .adr {
  color: var(--w-fg);
}

html:root:root table.listing tr.deleted td,
html:root:root table.listing tr.deleted td a {
  color: var(--w-muted-fg);
  text-decoration: line-through;
}

html:root:root table.listing tr.flagged td,
html:root:root table.listing tr.flagged td a,
html:root:root table.listing tr.flagged td span {
  color: var(--w-danger);
}

html:root:root table.listing thead td,
html:root:root table.listing thead th {
  background-color: var(--w-sidebar);
  color: var(--w-muted-fg);
  font-weight: 500;
  border-color: var(--w-border);
}

html:root:root .msgicon.status.unread:before,
html:root:root table.listing tr.unread td.subject span.msgicon.status:before {
  color: var(--w-link);
}

/* ---------- Search bar ---------- */
html:root:root .searchbar,
html:root:root .searchbar.open,
html:root:root #layout-list .header .searchbar {
  background-color: transparent;
}

html:root:root .searchbar input,
html:root:root .searchbar input:focus,
html:root:root input.form-control.search {
  background-color: var(--w-input);
  border: 1px solid var(--w-input-border);
  border-radius: var(--w-radius);
}

html:root:root .searchbar input:focus {
  border-color: var(--w-link);
  box-shadow: 0 0 0 3px var(--w-ring);
}

/* ---------- Buttons ---------- */
html:root:root .btn {
  border-radius: var(--w-radius);
  font-weight: 500;
  box-shadow: none;
  transition: background-color .15s, border-color .15s, color .15s;
}

html:root:root .btn-primary,
html:root:root .btn.mainaction,
html:root:root .btn-primary.disabled,
html:root:root .btn-primary:disabled,
html:root:root button.mainaction {
  background-color: var(--w-primary);
  border-color: var(--w-primary);
  color: var(--w-primary-fg);
}

html:root:root .btn-primary:hover,
html:root:root .btn-primary:not(:disabled):not(.disabled):active,
html:root:root .btn.mainaction:hover,
html:root:root button.mainaction:hover {
  background-color: var(--w-primary-hover);
  border-color: var(--w-primary-hover);
  color: var(--w-primary-fg);
}

html:root:root .btn-primary:focus,
html:root:root .btn:focus,
html:root:root .btn.focus {
  box-shadow: 0 0 0 3px var(--w-ring) !important;
}

html:root:root .btn-secondary,
html:root:root .btn.cancel,
html:root:root .btn-secondary.disabled,
html:root:root .btn-secondary:disabled {
  background-color: var(--w-card);
  border: 1px solid var(--w-input-border);
  color: var(--w-fg);
}

html:root:root .btn-secondary:hover,
html:root:root .btn.cancel:hover,
html:root:root .btn-secondary:not(:disabled):not(.disabled):active {
  background-color: var(--w-active);
  border-color: var(--w-input-border);
  color: var(--w-fg);
}

html:root:root .btn-danger,
html:root:root .btn.delete {
  background-color: var(--w-danger);
  border-color: var(--w-danger);
  color: #FFFFFF;
}

/* ---------- Form fields ---------- */
html:root:root .form-control,
html:root:root .custom-select,
html:root:root input[type="text"],
html:root:root input[type="email"],
html:root:root input[type="password"],
html:root:root input[type="search"],
html:root:root input[type="number"],
html:root:root select,
html:root:root textarea,
html:root:root .input-group-text,
html:root:root .recipient-input {
  background-color: var(--w-input);
  border-color: var(--w-input-border);
  color: var(--w-fg);
  border-radius: var(--w-radius);
}

html:root:root .input-group > .form-control:not(:last-child),
html:root:root .input-group > .custom-select:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

html:root:root .input-group > .input-group-append > .btn,
html:root:root .input-group > .input-group-append > .input-group-text {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

html:root:root .input-group > .input-group-prepend > .input-group-text {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

html:root:root .form-control:focus,
html:root:root .custom-select:focus,
html:root:root input:focus,
html:root:root select:focus,
html:root:root textarea:focus,
html:root:root .recipient-input.focus {
  border-color: var(--w-link);
  box-shadow: 0 0 0 3px var(--w-ring);
  outline: 0;
}

html:root:root .custom-control-input:checked ~ .custom-control-label:before,
html:root:root .custom-switch .custom-control-input:checked ~ .custom-control-label:before,
html:root:root input.custom-control-input:checked + label:before {
  background-color: var(--w-primary);
  border-color: var(--w-primary);
}

html:root:root .custom-switch .custom-control-input:checked ~ .custom-control-label:after {
  background-color: var(--w-primary-fg);
}

html:root:root input[type="checkbox"],
html:root:root input[type="radio"] {
  accent-color: var(--w-primary);
}

html:root:root .propform label,
html:root:root .propform td.title,
html:root:root .formcontent .title,
html:root:root legend,
html:root:root fieldset > legend {
  color: var(--w-fg);
  font-weight: 500;
}

html:root:root fieldset {
  border-color: var(--w-border);
}

/* Tabs in settings and compose */
html:root:root .nav-tabs,
html:root:root .tabsbar {
  border-color: var(--w-border);
}

html:root:root .nav-tabs .nav-link,
html:root:root .tabsbar a {
  color: var(--w-muted-fg);
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-weight: 500;
}

html:root:root .nav-tabs .nav-link.active,
html:root:root .nav-tabs .nav-link:hover,
html:root:root .tabsbar a.selected {
  color: var(--w-fg);
  border-bottom-color: var(--w-fg);
  background: transparent;
}

/* ---------- Popovers, menus and dialogs ---------- */
html:root:root .popover,
html:root:root .popupmenu,
html:root:root .ui-dialog,
html:root:root .ui-menu,
html:root:root .ui-autocomplete,
html:root:root .dropdown-menu {
  background-color: var(--w-card);
  border: 1px solid var(--w-border);
  border-radius: calc(var(--w-radius) + 2px);
  box-shadow: var(--w-shadow);
  color: var(--w-fg);
}

html:root:root .popover-body,
html:root:root .popover .popover-body {
  background-color: transparent;
  color: var(--w-fg);
}

html:root:root .popover .arrow:after,
html:root:root .popover .arrow:before {
  display: none;
}

html:root:root .popover .popover-header {
  background-color: var(--w-card);
  border-color: var(--w-border);
  color: var(--w-fg);
}

html:root:root .menu a,
html:root:root .popupmenu a,
html:root:root .ui-menu .ui-menu-item a,
html:root:root .listing.menu li a {
  color: var(--w-fg);
  border-radius: 6px;
}

html:root:root .popover .menu li a:not(.disabled):hover,
html:root:root .popupmenu li a:not(.disabled):hover,
html:root:root .ui-menu .ui-menu-item a.ui-state-active,
html:root:root .ui-menu .ui-menu-item-wrapper.ui-state-active {
  background-color: var(--w-hover);
  color: var(--w-fg);
  border: 0;
}

html:root:root .popover .menu li a.disabled,
html:root:root .popupmenu li a.disabled {
  color: var(--w-muted-fg);
  opacity: .5;
}

html:root:root .ui-dialog .ui-dialog-titlebar {
  background-color: transparent;
  border-color: var(--w-border);
  color: var(--w-fg);
}

html:root:root .ui-dialog .ui-dialog-title {
  font-weight: 600;
}

html:root:root .ui-dialog .ui-dialog-buttonpane {
  background-color: transparent;
  border-color: var(--w-border);
}

html:root:root .ui-widget-overlay {
  background: rgba(0, 0, 0, 0.5);
  opacity: 1;
}

html:root:root .ui-dialog-content,
html:root:root .ui-dialog .ui-widget-content {
  background-color: var(--w-card);
  color: var(--w-fg);
}

/* Toast messages */
html:root:root #messagestack div {
  background-color: var(--w-primary);
  color: var(--w-primary-fg);
  border: 0;
  border-radius: var(--w-radius);
  box-shadow: var(--w-shadow);
}

html:root:root #messagestack div.error {
  background-color: var(--w-danger);
  color: #FFFFFF;
}

/* ---------- Message view / compose (inside iframes) ---------- */
html:root:root body.iframe,
html:root:root body.iframe #layout-content,
html:root:root #message-header,
html:root:root #message-content,
html:root:root .message-partheaders,
html:root:root #messagebody,
html:root:root #compose-content,
html:root:root .formcontent {
  background-color: var(--w-bg);
  color: var(--w-fg);
}

html:root:root #message-header {
  border-bottom: 1px solid var(--w-border);
}

html:root:root #message-header .subject {
  font-weight: 600;
  letter-spacing: -0.01em;
}

html:root:root #message-header .header-links a,
html:root:root .header-links a {
  color: var(--w-muted-fg);
}

html:root:root #message-objects div,
html:root:root .boxinformation,
html:root:root .boxwarning,
html:root:root .boxconfirmation,
html:root:root .boxerror,
html:root:root .alert {
  border-radius: var(--w-radius);
}

/* ---------- Sender avatars (coloured initials) ---------- */
html:root:root .w-av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font: 600 12.5px/1 var(--w-font);
  letter-spacing: .02em;
  flex: none;
  user-select: none;
}

html:root:root .w-av-0 { background: #E6F1FB; color: #0C447C; }
html:root:root .w-av-1 { background: #E1F5EE; color: #085041; }
html:root:root .w-av-2 { background: #EEEDFE; color: #3C3489; }
html:root:root .w-av-3 { background: #FAECE7; color: #712B13; }
html:root:root .w-av-4 { background: #FBEAF0; color: #72243E; }
html:root:root .w-av-5 { background: #FAEEDA; color: #633806; }
html:root:root .w-av-6 { background: #EAF3DE; color: #27500A; }
html:root:root .w-av-7 { background: #F1EFE8; color: #444441; }

html.dark-mode:root:root .w-av-0 { background: #0C447C; color: #B5D4F4; }
html.dark-mode:root:root .w-av-1 { background: #085041; color: #9FE1CB; }
html.dark-mode:root:root .w-av-2 { background: #3C3489; color: #CECBF6; }
html.dark-mode:root:root .w-av-3 { background: #712B13; color: #F5C4B3; }
html.dark-mode:root:root .w-av-4 { background: #72243E; color: #F4C0D1; }
html.dark-mode:root:root .w-av-5 { background: #633806; color: #FAC775; }
html.dark-mode:root:root .w-av-6 { background: #27500A; color: #C0DD97; }
html.dark-mode:root:root .w-av-7 { background: #444441; color: #D3D1C7; }

/* Message list, style D: roomy rows, avatar, "New" pill, chips */
html:root:root #messagelist td.subject.w-has-av {
  position: relative;
  padding: 14px 12px 14px 62px !important;
  line-height: 1.4;
}

html:root:root #messagelist td.subject > .w-av {
  position: absolute;
  left: 12px;
  top: 14px;
  width: 38px;
  height: 38px;
  font-size: 13px;
}

html:root:root #messagelist td.subject.w-has-av span.fromto {
  font-size: 14px;
  line-height: 20px;
}

html:root:root #messagelist td.subject.w-has-av span.date,
html:root:root #messagelist td.subject.w-has-av span.size {
  font-size: 12px;
  line-height: 20px;
}

html:root:root #messagelist td.subject.w-has-av span.subject {
  font-size: 13px;
  line-height: 19px;
  margin: 2px 0 0;
}

html:root:root #messagelist .w-new {
  display: none;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font: 600 11px/16px var(--w-font);
  background: rgba(0, 102, 255, 0.1);
  color: #0058DB;
  vertical-align: 1px;
}

html.dark-mode:root:root #messagelist .w-new {
  background: rgba(37, 125, 224, 0.2);
  color: #8DBEF5;
}

html:root:root #messagelist tr.unread .w-new {
  display: inline-block;
}

html:root:root #messagelist .w-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

html:root:root #messagelist .w-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border: 1px solid var(--w-border);
  border-radius: 6px;
  font: 500 11.5px/18px var(--w-font);
  color: var(--w-muted-fg);
  white-space: nowrap;
}

/* The chip replaces the small attachment icon on the right */
html:root:root #messagelist tr.w-has-att td.flags span.attachment {
  display: none;
}

/* Read rows step back: lighter sender and subject */
html:root:root #messagelist tr:not(.unread) td.subject.w-has-av span.fromto,
html:root:root #messagelist tr:not(.unread) td.subject.w-has-av span.fromto .adr,
html:root:root #messagelist tr:not(.unread) td.subject.w-has-av span.subject a,
html:root:root #messagelist tr:not(.unread) td.subject.w-has-av span.subject a span {
  color: var(--w-muted-fg) !important;
  font-weight: 400 !important;
}

html:root:root #messagelist tr.unread td.subject.w-has-av span.fromto,
html:root:root #messagelist tr.unread td.subject.w-has-av span.fromto .adr {
  color: var(--w-fg) !important;
  font-weight: 600;
}

/* Email header: initials instead of the grey placeholder */
html:root:root #message-header .w-av-lg {
  width: 46px;
  height: 46px;
  font-size: 16px;
  float: left;
  margin-right: 12px;
}

html:root:root #message-header .w-av-lg + img.contactphoto:not(.w-real) {
  display: none;
}

/* ---------- Reading: Inter body text + folded history (style A) ---------- */
html:root:root #messagebody div.pre {
  font-family: var(--w-font) !important;
  font-size: 14px;
  line-height: 1.65;
  color: var(--w-fg);
}

html:root:root #messagebody .message-part,
html:root:root #messagebody .message-htmlpart {
  padding-bottom: 1rem;
}

html:root:root #messagebody .message-part:not(.wq-open) .wq-h,
html:root:root #messagebody .message-htmlpart:not(.wq-open) .wq-h {
  display: none !important;
}

html:root:root #messagebody .wq-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 4px;
  padding: 4px 12px 4px 10px;
  font: 500 12px/1.5 var(--w-font);
  color: var(--w-muted-fg);
  background: transparent;
  border: 1px solid var(--w-input-border);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}

html:root:root #messagebody .wq-toggle:hover {
  background: var(--w-hover);
  color: var(--w-fg);
}

html:root:root #messagebody .wq-open > .wq-toggle,
html:root:root #messagebody .wq-open .wq-toggle {
  color: var(--w-fg);
}

/* Expanded plain-text history is muted so the new reply stands out */
html:root:root #messagebody .message-part.wq-open div.pre > .wq-h:not(br) {
  color: var(--w-muted-fg);
}

/* Rich editor (TinyMCE) with Lucide icons */
html:root:root .tox.tox-tinymce {
  border: 1px solid var(--w-input-border);
  border-radius: var(--w-radius);
}

/* Keep the editor toolbar visible while scrolling long emails: sticky inside
   Roundcube's own scrolling form (TinyMCE's window-based sticky covered the
   Save/Attach bar). Overflow must be visible for CSS sticky to work. */
html:root:root .tox.tox-tinymce,
html:root:root .tox .tox-editor-container {
  overflow: visible !important;
}

html:root:root .tox .tox-editor-header {
  position: sticky !important;
  top: 0;
  z-index: 5;
  border-radius: var(--w-radius) var(--w-radius) 0 0;
  box-shadow: 0 -16px 0 var(--w-bg) !important;
}

html:root:root .tox .tox-editor-header,
html:root:root .tox .tox-toolbar,
html:root:root .tox .tox-toolbar__primary,
html:root:root .tox .tox-toolbar__overflow,
html:root:root .tox:not(.tox-tinymce-inline) .tox-editor-header {
  background: var(--w-sidebar) !important;
  border-color: var(--w-border) !important;
}

html:root:root .tox .tox-toolbar__group {
  border-color: var(--w-border) !important;
  padding: 0 4px;
}

html:root:root .tox .tox-tbtn {
  color: var(--w-fg);
  border-radius: 6px;
  height: 32px;
  margin: 3px 1px;
}

html:root:root .tox .tox-tbtn:hover,
html:root:root .tox .tox-tbtn--enabled,
html:root:root .tox .tox-tbtn--enabled:hover {
  background: var(--w-active) !important;
  color: var(--w-fg);
}

html:root:root .tox svg.lucide,
html:root:root .tox .tox-tbtn svg.lucide,
html:root:root .tox .tox-collection__item-icon svg.lucide {
  fill: none !important;
  stroke: currentColor;
  width: 18px;
  height: 18px;
}

html:root:root .tox .tox-tbtn__select-label {
  font-family: var(--w-font);
  font-size: 13px;
  color: var(--w-fg);
}

html:root:root .tox .tox-statusbar {
  background: var(--w-sidebar);
  border-color: var(--w-border);
  color: var(--w-muted-fg);
}

/* Compose: editor toolbar, recipient field, attachment drop zone */
html:root:root .editor-toolbar {
  background-color: var(--w-sidebar);
  border: 1px solid var(--w-input-border);
  border-bottom: 0;
  border-radius: var(--w-radius) var(--w-radius) 0 0;
  color: var(--w-fg);
}

html:root:root .editor-toolbar + textarea,
html:root:root .editor-toolbar ~ textarea.form-control {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

html:root:root .recipient-input input,
html:root:root .recipient-input input:focus {
  box-shadow: none;
  border: 0;
  background: transparent;
}

html:root:root .recipient-input .recipient {
  background-color: var(--w-active);
  border-color: var(--w-input-border);
  border-radius: 6px;
  color: var(--w-fg);
}

html:root:root .file-upload.droptarget,
html:root:root #compose-attachments {
  border-color: var(--w-input-border);
  border-radius: var(--w-radius);
}

html:root:root .file-upload.droptarget.hover,
html:root:root .file-upload.droptarget.active {
  border-color: var(--w-link);
  background-color: var(--w-hover);
}

html:root:root .attachmentslist li {
  border-radius: var(--w-radius);
  border-color: var(--w-border);
}

/* Scrollbars (scrollbar-color wins over ::-webkit-scrollbar in current Chrome) */
html:root:root,
html:root:root * {
  scrollbar-color: var(--w-selected) transparent;
  scrollbar-width: thin;
}

html:root:root *::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

html:root:root *::-webkit-scrollbar-thumb {
  background-color: var(--w-selected);
  border-radius: 999px;
  border: 2px solid var(--w-bg);
}

html:root:root *::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- Login page ---------- */
html:root:root body.task-login {
  background-color: var(--w-sidebar);
  background-image: radial-gradient(ellipse 60% 45% at 50% 0%, rgba(0, 102, 255, 0.07), transparent 70%);
  background-repeat: no-repeat;
}

html.dark-mode:root:root body.task-login {
  background-color: var(--w-bg);
  background-image: radial-gradient(ellipse 60% 45% at 50% 0%, rgba(37, 125, 224, 0.12), transparent 70%);
}

html:root:root body.task-login #layout-content {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start !important;
  padding: 14vh 16px 2rem !important;
  box-sizing: border-box;
}

html:root:root body.task-login .w-login-head {
  text-align: center;
  margin-bottom: 1.5rem;
}

html:root:root body.task-login .w-login-head h1 {
  font: 600 1.375rem/1.3 var(--w-font);
  letter-spacing: -0.02em;
  color: var(--w-fg);
  margin: 0 0 .35rem;
}

html:root:root body.task-login .w-login-head p {
  font-size: .9rem;
  color: var(--w-muted-fg);
  margin: 0;
}

html:root:root body.task-login .input-group .form-control,
html:root:root body.task-login .input-group .input-group-text {
  height: 44px;
}

html:root:root body.task-login .input-group {
  margin-bottom: .75rem;
}

html:root:root body.task-login #login-footer a:hover {
  color: var(--w-fg);
}

html.dark-mode:root:root body.task-login #logo {
  filter: invert(1);
}

html:root:root body.task-login #layout,
html:root:root body.task-login #layout-content {
  background-color: transparent;
}

html:root:root body.task-login #layout-content > .header {
  display: none;
}

html:root:root body.task-login #logo {
  width: 72px;
  max-width: 72px;
  max-height: 40px;
  margin: 0 auto 1.5rem;
  display: block;
}

html:root:root body.task-login #layout-content form {
  background-color: var(--w-card);
  border: 1px solid var(--w-border);
  border-radius: 14px;
  box-shadow: var(--w-shadow);
  padding: 2rem 2rem 1.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

html:root:root body.task-login #layout-content form table,
html:root:root body.task-login #layout-content form td {
  background: transparent;
  border: 0;
}

html:root:root body.task-login #rcmloginsubmit {
  width: 100%;
  padding: .7rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  margin-top: .5rem;
  height: 44px;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

html:root:root body.task-login .input-group-text {
  background-color: var(--w-sidebar);
  color: var(--w-muted-fg);
}

html:root:root body.task-login #login-footer,
html:root:root body.task-login #login-footer a {
  color: var(--w-muted-fg);
  font-size: .8rem;
}

/* ---------- Phone / small screens ---------- */
/* Slide-out app menu: icon beside a readable label, like the admin sidebar */
html.layout-phone:root:root #taskmenu a,
html.layout-small:root:root #taskmenu a {
  display: flex !important;
  align-items: center;
  gap: 12px;
  width: auto !important;
  height: 44px;
  margin: 2px 8px !important;
  padding: 0 12px !important;
  border: 0 !important;
  font-size: 14px !important;
  text-align: left;
}

html.layout-phone:root:root #taskmenu a:before,
html.layout-small:root:root #taskmenu a:before {
  float: none !important;
  width: 20px !important;
  height: 20px !important;
  margin: 0 !important;
  line-height: 20px;
}

html.layout-phone:root:root #taskmenu a .inner,
html.layout-small:root:root #taskmenu a .inner {
  display: inline !important;
}

/* Floating compose button: Workio primary instead of Roundcube blue */
html:root:root .floating-action-buttons a.button {
  background: var(--w-primary) !important;
  color: var(--w-primary-fg) !important;
  box-shadow: var(--w-shadow);
}

@media (max-width: 480px) {
  html:root:root body.task-login #layout-content form {
    padding: 1.5rem 1.25rem 1.25rem;
    border-radius: 12px;
    box-shadow: none;
  }

  /* 16px avoids iOS zoom on focus */
  html:root:root .form-control,
  html:root:root input,
  html:root:root select,
  html:root:root textarea {
    font-size: 16px;
  }
}

@media (max-width: 768px) {
  html:root:root #layout-menu {
    background-color: var(--w-card);
    box-shadow: var(--w-shadow);
  }
}
