/* ==========================================================================
   Feza Logistics — Roundcube Elastic Skin Override (v4)
   Company: Feza Logistics (fezalogistics.com)
   Target:  Roundcube "elastic" skin
   ========================================================================== */

/* --------------------------------------------------------------------------
   §1  FONT IMPORT & CSS CUSTOM PROPERTIES
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --feza-primary: #1a73e8;
  --feza-primary-hover: #1765cc;
  --feza-primary-light: #e8f0fe;
  --feza-primary-dark: #1557b0;
  --feza-red: #d93025;
  --feza-green: #1e8e3e;
  --feza-yellow: #f9ab00;
  --feza-bg: #f6f8fc;
  --feza-bg-white: #ffffff;
  --feza-text-primary: #202124;
  --feza-text-secondary: #5f6368;
  --feza-text-tertiary: #80868b;
  --feza-border: #e0e0e0;
  --feza-border-light: #f0f0f0;
  --feza-hover-bg: #f1f3f4;
  --feza-selected-bg: #e8f0fe;
  --feza-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.1);
  --feza-shadow-md: 0 2px 6px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
  --feza-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --feza-radius: 8px;
  --feza-radius-lg: 12px;
  --feza-radius-pill: 100px;
  --feza-font: 'Inter', 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* --------------------------------------------------------------------------
   §2  KEYFRAME ANIMATIONS
   -------------------------------------------------------------------------- */
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(26, 115, 232, 0.4); }
  50%      { box-shadow: 0 4px 24px rgba(26, 115, 232, 0.65); }
}

/* --------------------------------------------------------------------------
   §3  GLOBAL TYPOGRAPHY (scoped to body)
   -------------------------------------------------------------------------- */
body.task-mail,
body.task-settings,
body.task-addressbook,
body.task-login {
  font-family: var(--feza-font);
  color: var(--feza-text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   §4  MODERN SCROLLBARS (scoped)
   -------------------------------------------------------------------------- */
#layout *::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

#layout *::-webkit-scrollbar-track {
  background: transparent;
}

#layout *::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

#layout *::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.28);
}

/* Firefox */
#layout * {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

/* ==========================================================================
   §5  LOGIN PAGE
   ========================================================================== */

/* --- 5a. Background --- */
body.task-login {
  background: linear-gradient(135deg, #1a73e8, #6c4fe8, #1a73e8, #4285f4);
  background-size: 300% 300%;
  animation: gradientShift 12s ease infinite;
  min-height: 100vh;
  margin: 0;
}

/* --- 5b. Layout container --- */
body.task-login #layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: transparent;
}

/* --- 5c. Hide .voice heading (screen-reader only) --- */
body.task-login #layout h1.voice {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* --- 5d. Login card --- */
body.task-login #layout-content {
  background: var(--feza-bg-white);
  border-radius: var(--feza-radius-lg);
  box-shadow: var(--feza-shadow-lg);
  max-width: 440px;
  width: 100%;
  padding: 40px 36px 32px;
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.6s ease-out;
}

/* Top accent bar on card */
body.task-login #layout-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #1a73e8, #6c4fe8, #4285f4);
  border-radius: var(--feza-radius-lg) var(--feza-radius-lg) 0 0;
}

/* --- 5e. Logo --- */
body.task-login #logo {
  display: block;
  margin: 0 auto 16px;
  max-height: 54px;
  width: auto;
}

/* --- 5f. Subtitle --- */
body.task-login #login-subtitle {
  text-align: center;
  color: var(--feza-text-secondary);
  font-size: 14px;
  font-weight: 400;
  margin: 0 0 28px;
}

/* --- 5g. Form table (raw state before JS transforms) --- */
body.task-login #login-form table {
  width: 100%;
  border-collapse: collapse;
}

body.task-login #login-form table td {
  padding: 0;
  border: none;
}

body.task-login #login-form table td.title {
  display: none;
}

body.task-login #login-form table td.input {
  display: block;
  width: 100%;
  padding-bottom: 14px;
}

/* --- 5h. Form controls (both raw and JS-transformed states) --- */
body.task-login .propform .form-control {
  font-family: var(--feza-font);
  font-size: 14px;
  border: 1.5px solid var(--feza-border);
  border-radius: var(--feza-radius);
  padding: 10px 14px;
  color: var(--feza-text-primary);
  background: var(--feza-bg-white);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  height: auto;
}

body.task-login .propform .form-control:focus {
  border-color: var(--feza-primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
  outline: none;
}

body.task-login .propform .form-control::placeholder {
  color: var(--feza-text-tertiary);
}

/* --- 5i. Input-group (JS-transformed state) — icon + input inline --- */
body.task-login .propform .input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
  margin-bottom: 14px;
}

body.task-login .propform .input-group .input-group-prepend {
  display: flex;
  align-items: center;
}

body.task-login .propform .input-group .input-group-prepend .input-group-text {
  background: var(--feza-bg);
  border: 1.5px solid var(--feza-border);
  border-right: none;
  border-radius: var(--feza-radius) 0 0 var(--feza-radius);
  color: var(--feza-text-tertiary);
  padding: 0 12px;
  min-width: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.task-login .propform .input-group .form-control {
  flex: 1 1 auto !important;
  width: 1% !important;
  border-radius: 0 var(--feza-radius) var(--feza-radius) 0;
  margin-bottom: 0;
}

/* --- 5j. Submit button --- */
body.task-login .propform .formbuttons {
  margin: 8px 0 0;
  padding: 0;
  text-align: center;
}

body.task-login .propform .formbuttons .button.mainaction {
  width: 100%;
  padding: 11px 24px;
  background: var(--feza-primary);
  color: #fff;
  border: none;
  border-radius: var(--feza-radius-pill);
  font-family: var(--feza-font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

body.task-login .propform .formbuttons .button.mainaction:hover {
  background: var(--feza-primary-hover);
  box-shadow: var(--feza-shadow-sm);
}

body.task-login .propform .formbuttons .button.mainaction:active {
  background: var(--feza-primary-dark);
}

/* --- 5k. Footer --- */
body.task-login #login-footer {
  text-align: center;
  font-size: 12px;
  color: var(--feza-text-tertiary);
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--feza-border-light);
}

/* ==========================================================================
   §6  MAIN LAYOUT SHELL
   ========================================================================== */
body.task-mail #layout,
body.task-settings #layout,
body.task-addressbook #layout {
  background: var(--feza-bg);
}

body.task-mail #layout-content,
body.task-settings #layout-content,
body.task-addressbook #layout-content {
  background: var(--feza-bg-white);
}

/* ==========================================================================
   §7  TASK MENU (left icon bar)
   ========================================================================== */
#taskmenu {
  background: var(--feza-bg-white);
  border-right: 1px solid var(--feza-border-light);
}

#taskmenu a {
  color: var(--feza-text-secondary);
  border-radius: var(--feza-radius-pill);
  margin: 2px 6px;
  padding: 8px;
  transition: background-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
}

#taskmenu a:hover {
  background: var(--feza-hover-bg);
  color: var(--feza-text-primary);
  text-decoration: none;
}

#taskmenu a.selected,
#taskmenu a.button.selected {
  background: var(--feza-selected-bg);
  color: var(--feza-primary);
  position: relative;
}

#taskmenu a.selected::after {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  bottom: 25%;
  width: 3px;
  background: var(--feza-primary);
  border-radius: 0 3px 3px 0;
}

/* ==========================================================================
   §8  TOOLBAR
   ========================================================================== */
#layout .toolbar {
  background: var(--feza-bg-white);
  border-bottom: 1px solid var(--feza-border-light);
}

#layout .toolbar a.button {
  color: var(--feza-text-secondary);
  border-radius: var(--feza-radius);
  margin: 2px 1px;
  transition: background-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
}

#layout .toolbar a.button:hover {
  background: var(--feza-hover-bg);
  color: var(--feza-text-primary);
  text-decoration: none;
}

#layout .toolbar a.button.disabled {
  opacity: 0.38;
  pointer-events: none;
}

/* ==========================================================================
   §9  SEARCH BAR
   ========================================================================== */
#layout .searchbar {
  background: var(--feza-hover-bg);
  border-radius: var(--feza-radius-pill);
  border: 1px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

#layout .searchbar:focus-within {
  background: var(--feza-bg-white);
  border-color: var(--feza-border);
  box-shadow: var(--feza-shadow-sm);
}

#layout .searchbar input {
  font-family: var(--feza-font);
  font-size: 14px;
  color: var(--feza-text-primary);
  background: transparent;
  border: none;
}

#layout .searchbar input::placeholder {
  color: var(--feza-text-tertiary);
}

/* ==========================================================================
   §10  FOLDER / MAILBOX SIDEBAR
   ========================================================================== */
#layout-sidebar {
  background: var(--feza-bg-white);
  border-right: 1px solid var(--feza-border-light);
}

#mailboxlist li a {
  color: var(--feza-text-primary);
  font-family: var(--feza-font);
  font-size: 13.5px;
  font-weight: 400;
  padding: 6px 12px;
  border-radius: 0 var(--feza-radius-pill) var(--feza-radius-pill) 0;
  margin-right: 8px;
  transition: background-color 0.15s ease;
  text-decoration: none;
}

#mailboxlist li a:hover {
  background: var(--feza-hover-bg);
  text-decoration: none;
}

#mailboxlist li.selected > a {
  background: var(--feza-selected-bg);
  color: var(--feza-primary);
  font-weight: 600;
}

/* Unread count badges */
#mailboxlist li a .unreadcount {
  background: var(--feza-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--feza-radius-pill);
  min-width: 20px;
  text-align: center;
}

#mailboxlist li.inbox > a .unreadcount {
  background: var(--feza-red);
}

/* Folder icons */
#mailboxlist li a::before {
  color: var(--feza-text-tertiary);
}

#mailboxlist li.selected > a::before {
  color: var(--feza-primary);
}

/* ==========================================================================
   §11  MESSAGE LIST
   ========================================================================== */
#messagelist {
  background: var(--feza-bg-white);
}

/* CRITICAL: Only font-family and font-size on td — nothing else */
#messagelist td {
  font-family: var(--feza-font);
  font-size: 13.5px;
}

#messagelist tr {
  border-bottom: 1px solid var(--feza-border-light);
  transition: background-color 0.12s ease, box-shadow 0.12s ease;
}

#messagelist tr:hover {
  background: var(--feza-hover-bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

#messagelist tr.selected {
  background: var(--feza-selected-bg);
}

/* Unread messages — bolder appearance */
#messagelist tr.unread td.subject span.subject {
  font-weight: 600;
  color: var(--feza-text-primary);
}

#messagelist tr.unread td.fromto {
  font-weight: 600;
  color: var(--feza-text-primary);
}

/* Read messages — lighter */
#messagelist tr:not(.unread) td.subject span.subject {
  color: var(--feza-text-secondary);
}

#messagelist tr:not(.unread) td.fromto {
  color: var(--feza-text-secondary);
}

/* Date / time column */
#messagelist td.date {
  color: var(--feza-text-tertiary);
  font-size: 12px;
}

/* Flagged messages */
#messagelist tr.flagged td.subject span.subject {
  color: var(--feza-yellow);
}

/* Message status icons */
#messagelist td.status span {
  color: var(--feza-text-tertiary);
}

#messagelist td.threads span {
  color: var(--feza-text-tertiary);
}

/* ==========================================================================
   §12  READING PANE / MESSAGE VIEW
   ========================================================================== */
#message-header {
  background: var(--feza-bg-white);
  border-bottom: 1px solid var(--feza-border-light);
  padding: 16px 20px;
}

#message-header .subject {
  font-family: var(--feza-font);
  font-size: 18px;
  font-weight: 600;
  color: var(--feza-text-primary);
  margin-bottom: 8px;
}

#message-header .header-title {
  font-family: var(--feza-font);
  font-size: 13px;
  color: var(--feza-text-tertiary);
}

#message-header .header-title .rcmContactAddress {
  color: var(--feza-text-secondary);
  font-weight: 500;
}

#messageBody,
#messagebody {
  font-family: var(--feza-font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--feza-text-primary);
  padding: 20px;
}

/* ==========================================================================
   §13  COMPOSE
   ========================================================================== */
#composebody {
  font-family: var(--feza-font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--feza-text-primary);
  border: 1px solid var(--feza-border);
  border-radius: var(--feza-radius);
  padding: 12px;
}

#compose-content .form-control {
  font-family: var(--feza-font);
  font-size: 14px;
  border: 1px solid var(--feza-border);
  border-radius: var(--feza-radius);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#compose-content .form-control:focus {
  border-color: var(--feza-primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
  outline: none;
}

#compose-content .header-title {
  font-family: var(--feza-font);
  font-size: 13px;
  color: var(--feza-text-secondary);
  font-weight: 500;
}

/* Compose action buttons */
#compose-content .formbuttons .button {
  font-family: var(--feza-font);
  border-radius: var(--feza-radius-pill);
  font-weight: 500;
  padding: 8px 20px;
}

#compose-content .formbuttons .button.mainaction {
  background: var(--feza-primary);
  color: #fff;
  border: none;
  transition: background-color 0.2s ease;
}

#compose-content .formbuttons .button.mainaction:hover {
  background: var(--feza-primary-hover);
}

/* ==========================================================================
   §14  SETTINGS PAGES
   ========================================================================== */
body.task-settings #layout-content .propform {
  font-family: var(--feza-font);
}

body.task-settings #layout-content .propform td.title {
  font-size: 13px;
  font-weight: 500;
  color: var(--feza-text-secondary);
}

body.task-settings #layout-content .propform .form-control {
  font-family: var(--feza-font);
  font-size: 13.5px;
  border: 1px solid var(--feza-border);
  border-radius: var(--feza-radius);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.task-settings #layout-content .propform .form-control:focus {
  border-color: var(--feza-primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
  outline: none;
}

body.task-settings #layout-content .propform select.form-control {
  cursor: pointer;
}

body.task-settings .listbox .listing li a {
  color: var(--feza-text-primary);
  font-family: var(--feza-font);
  text-decoration: none;
}

body.task-settings .listbox .listing li a:hover {
  background: var(--feza-hover-bg);
  text-decoration: none;
}

body.task-settings .listbox .listing li.selected a {
  background: var(--feza-selected-bg);
  color: var(--feza-primary);
}

/* ==========================================================================
   §15  ADDRESS BOOK
   ========================================================================== */
body.task-addressbook #directorylist li a {
  font-family: var(--feza-font);
  color: var(--feza-text-primary);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

body.task-addressbook #directorylist li a:hover {
  background: var(--feza-hover-bg);
  text-decoration: none;
}

body.task-addressbook #directorylist li.selected a {
  background: var(--feza-selected-bg);
  color: var(--feza-primary);
}

body.task-addressbook #contacts-table td {
  font-family: var(--feza-font);
  font-size: 13.5px;
}

/* ==========================================================================
   §16  BUTTONS & UI ELEMENTS
   ========================================================================== */
#layout .footer .buttons a.button,
#layout .footer a.button {
  font-family: var(--feza-font);
  border-radius: var(--feza-radius);
  font-weight: 500;
  transition: background-color 0.15s ease;
  text-decoration: none;
}

/* Primary action buttons across the app */
#layout .formbuttons .button.mainaction,
#layout .footer .buttons a.button.mainaction {
  background: var(--feza-primary);
  color: #fff;
  border: none;
  border-radius: var(--feza-radius-pill);
  padding: 8px 20px;
  font-weight: 600;
}

#layout .formbuttons .button.mainaction:hover,
#layout .footer .buttons a.button.mainaction:hover {
  background: var(--feza-primary-hover);
}

/* Popups / dialogs */
.ui-dialog {
  border-radius: var(--feza-radius-lg) !important;
  box-shadow: var(--feza-shadow-lg) !important;
  border: none !important;
}

.ui-dialog .ui-dialog-titlebar {
  font-family: var(--feza-font);
  font-weight: 600;
  border-bottom: 1px solid var(--feza-border-light);
  background: var(--feza-bg-white);
  border-radius: var(--feza-radius-lg) var(--feza-radius-lg) 0 0;
}

.ui-dialog .ui-dialog-content {
  font-family: var(--feza-font);
}

.ui-dialog .ui-dialog-buttonpane {
  border-top: 1px solid var(--feza-border-light);
}

/* Dropdowns / popover menus */
.popover,
.dropdown-menu {
  border-radius: var(--feza-radius) !important;
  box-shadow: var(--feza-shadow-md) !important;
  border: 1px solid var(--feza-border-light) !important;
}

.dropdown-menu a.dropdown-item {
  font-family: var(--feza-font);
  font-size: 13.5px;
  color: var(--feza-text-primary);
  border-radius: 4px;
  margin: 2px 4px;
  transition: background-color 0.12s ease;
}

.dropdown-menu a.dropdown-item:hover {
  background: var(--feza-hover-bg);
  color: var(--feza-text-primary);
}

/* ==========================================================================
   §17  AI ASSISTANT WIDGET (#feza-ai-trigger, #feza-ai-panel)
   ========================================================================== */

/* --- 17a. Floating trigger button --- */
#feza-ai-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a73e8, #6c4fe8);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(26, 115, 232, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  z-index: 10000;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: pulse 2.5s ease-in-out infinite;
}

#feza-ai-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(26, 115, 232, 0.55);
  animation: none;
}

#feza-ai-trigger:active {
  transform: scale(0.96);
}

/* --- 17b. Chat panel --- */
#feza-ai-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 400px;
  height: 500px;
  background: var(--feza-bg-white);
  border-radius: var(--feza-radius-lg);
  box-shadow: var(--feza-shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10001;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#feza-ai-panel.feza-ai-panel--open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  animation: slideUp 0.3s ease-out;
}

/* --- 17c. Chat header --- */
.feza-ai-header {
  background: linear-gradient(135deg, #1a73e8, #6c4fe8);
  color: #fff;
  padding: 14px 18px;
  font-family: var(--feza-font);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.feza-ai-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background-color 0.15s ease;
}

.feza-ai-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* --- 17d. Chat messages area --- */
.feza-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Bot messages — left-aligned, gray */
.feza-ai-bubble.feza-ai-bubble--bot {
  align-self: flex-start;
  background: var(--feza-hover-bg);
  color: var(--feza-text-primary);
  padding: 10px 14px;
  border-radius: 4px 14px 14px 14px;
  max-width: 82%;
  font-family: var(--feza-font);
  font-size: 13.5px;
  line-height: 1.5;
}

/* User messages — right-aligned, blue */
.feza-ai-bubble.feza-ai-bubble--user {
  align-self: flex-end;
  background: var(--feza-primary);
  color: #fff;
  padding: 10px 14px;
  border-radius: 14px 4px 14px 14px;
  max-width: 82%;
  font-family: var(--feza-font);
  font-size: 13.5px;
  line-height: 1.5;
}

/* --- 17e. Chat input area --- */
.feza-ai-input-wrap {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--feza-border-light);
  background: var(--feza-bg-white);
  gap: 8px;
  flex-shrink: 0;
}

.feza-ai-input {
  flex: 1;
  border: 1px solid var(--feza-border);
  border-radius: var(--feza-radius-pill);
  padding: 8px 14px;
  font-family: var(--feza-font);
  font-size: 13.5px;
  color: var(--feza-text-primary);
  background: var(--feza-bg);
  outline: none;
  transition: border-color 0.2s ease;
}

.feza-ai-input:focus {
  border-color: var(--feza-primary);
}

.feza-ai-input::placeholder {
  color: var(--feza-text-tertiary);
}

.feza-ai-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--feza-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

.feza-ai-send:hover {
  background: var(--feza-primary-hover);
}

/* ==========================================================================
   §18  COMPOSE FLOATING ACTION BUTTON (#feza-compose-fab)
   ========================================================================== */
#feza-compose-fab {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  background: #e8453c;
  color: #fff;
  border: none;
  border-radius: var(--feza-radius-pill);
  font-family: var(--feza-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(232, 69, 60, 0.35);
  z-index: 9999;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  text-decoration: none;
}

#feza-compose-fab:hover {
  background: #d03a32;
  box-shadow: 0 6px 20px rgba(232, 69, 60, 0.5);
  transform: translateY(-2px);
  text-decoration: none;
  color: #fff;
}

#feza-compose-fab:active {
  transform: translateY(0);
}

#feza-compose-fab .fab-icon {
  font-size: 18px;
  line-height: 1;
}

#feza-compose-fab .fab-label {
  white-space: nowrap;
}

/* ==========================================================================
   §19  DARK MODE — html.dark-mode / body.dark-mode
   ========================================================================== */
html.dark-mode {
  --feza-bg: #1f1f1f;
  --feza-bg-white: #2d2d2d;
  --feza-text-primary: #e8eaed;
  --feza-text-secondary: #9aa0a6;
  --feza-text-tertiary: #6e7681;
  --feza-border: #444;
  --feza-border-light: #383838;
  --feza-hover-bg: #383838;
  --feza-selected-bg: rgba(26, 115, 232, 0.18);
  --feza-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --feza-shadow-md: 0 2px 8px rgba(0, 0, 0, 0.4);
  --feza-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

body.dark-mode {
  --feza-bg: #1f1f1f;
  --feza-bg-white: #2d2d2d;
  --feza-text-primary: #e8eaed;
  --feza-text-secondary: #9aa0a6;
  --feza-text-tertiary: #6e7681;
  --feza-border: #444;
  --feza-border-light: #383838;
  --feza-hover-bg: #383838;
  --feza-selected-bg: rgba(26, 115, 232, 0.18);
  --feza-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --feza-shadow-md: 0 2px 8px rgba(0, 0, 0, 0.4);
  --feza-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* --- 19a. Dark: Login page --- */
html.dark-mode body.task-login,
body.dark-mode.task-login {
  background: linear-gradient(135deg, #0d47a1, #4a148c, #0d47a1, #1565c0);
  background-size: 300% 300%;
  animation: gradientShift 12s ease infinite;
}

html.dark-mode body.task-login #layout-content,
body.dark-mode.task-login #layout-content {
  background: #2d2d2d;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

html.dark-mode body.task-login #login-subtitle,
body.dark-mode.task-login #login-subtitle {
  color: #9aa0a6;
}

html.dark-mode body.task-login .propform .form-control,
body.dark-mode.task-login .propform .form-control {
  background: #383838;
  border-color: #444;
  color: #e8eaed;
}

html.dark-mode body.task-login .propform .form-control:focus,
body.dark-mode.task-login .propform .form-control:focus {
  border-color: var(--feza-primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.25);
}

html.dark-mode body.task-login .propform .input-group .input-group-prepend .input-group-text,
body.dark-mode.task-login .propform .input-group .input-group-prepend .input-group-text {
  background: #333;
  border-color: #444;
  color: #6e7681;
}

html.dark-mode body.task-login #login-footer,
body.dark-mode.task-login #login-footer {
  color: #6e7681;
  border-top-color: #383838;
}

/* --- 19b. Dark: Main layout --- */
html.dark-mode #taskmenu,
body.dark-mode #taskmenu {
  background: #2d2d2d;
  border-right-color: #383838;
}

html.dark-mode #taskmenu a,
body.dark-mode #taskmenu a {
  color: #9aa0a6;
}

html.dark-mode #taskmenu a:hover,
body.dark-mode #taskmenu a:hover {
  background: #383838;
  color: #e8eaed;
}

html.dark-mode #taskmenu a.selected,
body.dark-mode #taskmenu a.selected {
  background: rgba(26, 115, 232, 0.18);
  color: #8ab4f8;
}

/* --- 19c. Dark: Sidebar --- */
html.dark-mode #layout-sidebar,
body.dark-mode #layout-sidebar {
  background: #2d2d2d;
  border-right-color: #383838;
}

html.dark-mode #mailboxlist li a,
body.dark-mode #mailboxlist li a {
  color: #e8eaed;
}

html.dark-mode #mailboxlist li a:hover,
body.dark-mode #mailboxlist li a:hover {
  background: #383838;
}

html.dark-mode #mailboxlist li.selected > a,
body.dark-mode #mailboxlist li.selected > a {
  background: rgba(26, 115, 232, 0.18);
  color: #8ab4f8;
}

/* --- 19d. Dark: Message list --- */
html.dark-mode #messagelist,
body.dark-mode #messagelist {
  background: #2d2d2d;
}

html.dark-mode #messagelist tr,
body.dark-mode #messagelist tr {
  border-bottom-color: #383838;
}

html.dark-mode #messagelist tr:hover,
body.dark-mode #messagelist tr:hover {
  background: #383838;
}

html.dark-mode #messagelist tr.selected,
body.dark-mode #messagelist tr.selected {
  background: rgba(26, 115, 232, 0.18);
}

html.dark-mode #messagelist tr.unread td.subject span.subject,
body.dark-mode #messagelist tr.unread td.subject span.subject {
  color: #e8eaed;
}

html.dark-mode #messagelist tr:not(.unread) td.subject span.subject,
body.dark-mode #messagelist tr:not(.unread) td.subject span.subject {
  color: #9aa0a6;
}

html.dark-mode #messagelist td.date,
body.dark-mode #messagelist td.date {
  color: #6e7681;
}

/* --- 19e. Dark: Reading pane --- */
html.dark-mode #message-header,
body.dark-mode #message-header {
  background: #2d2d2d;
  border-bottom-color: #383838;
}

html.dark-mode #message-header .subject,
body.dark-mode #message-header .subject {
  color: #e8eaed;
}

/* --- 19f. Dark: Toolbar & search --- */
html.dark-mode #layout .toolbar,
body.dark-mode #layout .toolbar {
  background: #2d2d2d;
  border-bottom-color: #383838;
}

html.dark-mode #layout .toolbar a.button,
body.dark-mode #layout .toolbar a.button {
  color: #9aa0a6;
}

html.dark-mode #layout .toolbar a.button:hover,
body.dark-mode #layout .toolbar a.button:hover {
  background: #383838;
  color: #e8eaed;
}

html.dark-mode #layout .searchbar,
body.dark-mode #layout .searchbar {
  background: #383838;
}

html.dark-mode #layout .searchbar:focus-within,
body.dark-mode #layout .searchbar:focus-within {
  background: #333;
  border-color: #555;
}

html.dark-mode #layout .searchbar input,
body.dark-mode #layout .searchbar input {
  color: #e8eaed;
}

/* --- 19g. Dark: Compose --- */
html.dark-mode #composebody,
body.dark-mode #composebody {
  background: #383838;
  border-color: #444;
  color: #e8eaed;
}

html.dark-mode #compose-content .form-control,
body.dark-mode #compose-content .form-control {
  background: #383838;
  border-color: #444;
  color: #e8eaed;
}

/* --- 19h. Dark: Dialogs --- */
html.dark-mode .ui-dialog,
body.dark-mode .ui-dialog {
  background: #2d2d2d !important;
}

html.dark-mode .ui-dialog .ui-dialog-titlebar,
body.dark-mode .ui-dialog .ui-dialog-titlebar {
  background: #2d2d2d;
  border-bottom-color: #383838;
  color: #e8eaed;
}

html.dark-mode .ui-dialog .ui-dialog-content,
body.dark-mode .ui-dialog .ui-dialog-content {
  color: #e8eaed;
}

html.dark-mode .dropdown-menu,
body.dark-mode .dropdown-menu {
  background: #2d2d2d !important;
  border-color: #444 !important;
}

html.dark-mode .dropdown-menu a.dropdown-item,
body.dark-mode .dropdown-menu a.dropdown-item {
  color: #e8eaed;
}

html.dark-mode .dropdown-menu a.dropdown-item:hover,
body.dark-mode .dropdown-menu a.dropdown-item:hover {
  background: #383838;
}

/* --- 19i. Dark: AI assistant --- */
html.dark-mode #feza-ai-panel,
body.dark-mode #feza-ai-panel {
  background: #2d2d2d;
}

html.dark-mode .feza-ai-bubble.feza-ai-bubble--bot,
body.dark-mode .feza-ai-bubble.feza-ai-bubble--bot {
  background: #383838;
  color: #e8eaed;
}

html.dark-mode .feza-ai-input-wrap,
body.dark-mode .feza-ai-input-wrap {
  background: #2d2d2d;
  border-top-color: #383838;
}

html.dark-mode .feza-ai-input,
body.dark-mode .feza-ai-input {
  background: #383838;
  border-color: #444;
  color: #e8eaed;
}

/* ==========================================================================
   §20  RESPONSIVE — TABLET (≤768px)
   ========================================================================== */
@media screen and (max-width: 768px) {
  /* Login card adjustments */
  body.task-login #layout-content {
    max-width: 400px;
    padding: 32px 28px 28px;
    margin: 0 12px;
  }

  body.task-login #logo {
    max-height: 46px;
  }

  body.task-login #login-subtitle {
    font-size: 13px;
  }

  /* AI assistant panel */
  #feza-ai-panel {
    width: 340px;
    height: 440px;
    right: 12px;
    bottom: 84px;
  }

  #feza-ai-trigger {
    width: 50px;
    height: 50px;
    bottom: 18px;
    right: 18px;
    font-size: 22px;
  }

  /* Compose FAB */
  #feza-compose-fab {
    bottom: 18px;
    left: 18px;
    padding: 12px 18px;
    font-size: 13px;
  }
}

/* ==========================================================================
   §21  RESPONSIVE — PHONE (≤480px)
   ========================================================================== */
@media screen and (max-width: 480px) {
  /* Login card — full width, less padding */
  body.task-login #layout {
    padding: 12px;
  }

  body.task-login #layout-content {
    max-width: 100%;
    padding: 28px 20px 24px;
    border-radius: var(--feza-radius);
  }

  body.task-login #logo {
    max-height: 40px;
    margin-bottom: 12px;
  }

  body.task-login #login-subtitle {
    font-size: 12.5px;
    margin-bottom: 22px;
  }

  body.task-login .propform .form-control {
    font-size: 16px; /* prevent iOS zoom */
    padding: 10px 12px;
  }

  body.task-login .propform .formbuttons .button.mainaction {
    font-size: 15px;
    padding: 12px 20px;
  }

  /* AI assistant — full width on phone */
  #feza-ai-panel {
    width: calc(100vw - 24px);
    height: 70vh;
    right: 12px;
    bottom: 78px;
    border-radius: var(--feza-radius);
  }

  #feza-ai-trigger {
    width: 48px;
    height: 48px;
    bottom: 14px;
    right: 14px;
    font-size: 20px;
  }

  /* Compose FAB — icon only on small screens */
  #feza-compose-fab .fab-label {
    display: none;
  }

  #feza-compose-fab {
    padding: 14px;
    border-radius: 50%;
    bottom: 14px;
    left: 14px;
  }

  /* Tighter spacing for mailbox UI */
  #mailboxlist li a {
    padding: 5px 10px;
    font-size: 13px;
  }
}

/* ==========================================================================
   §22  UTILITY — PRINT (hide custom widgets)
   ========================================================================== */
@media print {
  #feza-ai-trigger,
  #feza-ai-panel,
  #feza-compose-fab {
    display: none !important;
  }
}



/* ==========================================================================
   §23  SENDER AVATARS (.feza-avatar)
   ========================================================================== */
.feza-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  color: #fff;
  font-family: var(--feza-font);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  margin-right: 10px;
  flex-shrink: 0;
  user-select: none;
  vertical-align: middle;
}

#messagelist .feza-avatar {
  position: relative;
  top: -1px;
}

/* ==========================================================================
   §24  KEYBOARD SHORTCUTS OVERLAY (.feza-shortcuts-modal)
   ========================================================================== */
.feza-shortcuts-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.feza-shortcuts-modal--open {
  opacity: 1;
  pointer-events: auto;
}

.feza-shortcuts-card {
  background: var(--feza-bg-white, #fff);
  border-radius: var(--feza-radius-lg, 12px);
  box-shadow: var(--feza-shadow-lg, 0 8px 24px rgba(0,0,0,0.12));
  padding: 28px 32px;
  max-width: 420px;
  width: 90%;
  position: relative;
  animation: fadeInUp 0.3s ease-out;
}

.feza-shortcuts-title {
  font-family: var(--feza-font);
  font-size: 18px;
  font-weight: 600;
  color: var(--feza-text-primary, #202124);
  margin: 0 0 18px;
  padding: 0;
}

.feza-shortcuts-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--feza-hover-bg, #f1f3f4);
  color: var(--feza-text-secondary, #5f6368);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background-color 0.15s ease;
}

.feza-shortcuts-close:hover {
  background: var(--feza-border, #e0e0e0);
}

.feza-shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--feza-font);
}

.feza-shortcuts-table tr {
  border-bottom: 1px solid var(--feza-border-light, #f0f0f0);
}

.feza-shortcuts-table tr:last-child {
  border-bottom: none;
}

.feza-shortcuts-table td {
  padding: 8px 4px;
}

.feza-shortcuts-key kbd {
  display: inline-block;
  min-width: 28px;
  padding: 3px 8px;
  background: var(--feza-bg, #f6f8fc);
  border: 1px solid var(--feza-border, #e0e0e0);
  border-radius: 6px;
  font-family: var(--feza-font);
  font-size: 12px;
  font-weight: 600;
  color: var(--feza-text-primary, #202124);
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.feza-shortcuts-desc {
  font-size: 13.5px;
  color: var(--feza-text-secondary, #5f6368);
  padding-left: 12px !important;
}

/* ==========================================================================
   §25  WELCOME TOAST (.feza-welcome-toast)
   ========================================================================== */
.feza-welcome-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--feza-text-primary, #202124);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--feza-radius-pill, 100px);
  font-family: var(--feza-font);
  font-size: 13.5px;
  line-height: 1.5;
  z-index: 10003;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
  max-width: 90vw;
}

.feza-welcome-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.feza-welcome-toast-text {
  flex: 1;
}

.feza-welcome-toast-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

.feza-welcome-toast-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ==========================================================================
   §26  COMPOSE TEMPLATE DROPDOWN (.feza-template-dropdown)
   ========================================================================== */
.feza-template-dropdown {
  position: relative;
  display: inline-block;
  margin-left: 8px;
}

.feza-template-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--feza-primary, #1a73e8);
  color: #fff;
  border: none;
  border-radius: var(--feza-radius, 8px);
  font-family: var(--feza-font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.feza-template-trigger:hover {
  background: var(--feza-primary-hover, #1765cc);
  box-shadow: var(--feza-shadow-sm, 0 1px 2px rgba(0,0,0,0.06));
}

.feza-template-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  background: var(--feza-bg-white, #fff);
  border: 1px solid var(--feza-border, #e0e0e0);
  border-radius: var(--feza-radius, 8px);
  box-shadow: var(--feza-shadow-md, 0 2px 6px rgba(0,0,0,0.08));
  z-index: 1000;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  overflow: hidden;
}

.feza-template-menu--open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.feza-template-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  text-align: left;
  font-family: var(--feza-font);
  font-size: 13.5px;
  color: var(--feza-text-primary, #202124);
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.feza-template-item:hover {
  background: var(--feza-hover-bg, #f1f3f4);
}

.feza-template-item + .feza-template-item {
  border-top: 1px solid var(--feza-border-light, #f0f0f0);
}

/* ==========================================================================
   §27  AI QUICK ACTIONS & TYPING INDICATOR
   ========================================================================== */
.feza-ai-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.feza-ai-quick-btn {
  padding: 5px 12px;
  background: var(--feza-primary-light, #e8f0fe);
  color: var(--feza-primary, #1a73e8);
  border: 1px solid transparent;
  border-radius: var(--feza-radius-pill, 100px);
  font-family: var(--feza-font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.feza-ai-quick-btn:hover {
  background: #d2e3fc;
  border-color: var(--feza-primary, #1a73e8);
}

.feza-ai-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
  background: var(--feza-hover-bg, #f1f3f4);
  border-radius: 4px 14px 14px 14px;
}

.feza-ai-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--feza-text-tertiary, #80868b);
  animation: typingBounce 1.4s ease-in-out infinite;
}

.feza-ai-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.feza-ai-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ==========================================================================
   §28  DARK MODE — Additional component styles
   ========================================================================== */
html.dark-mode .feza-shortcuts-card,
body.dark-mode .feza-shortcuts-card {
  background: #2d2d2d;
}

html.dark-mode .feza-shortcuts-title,
body.dark-mode .feza-shortcuts-title {
  color: #e8eaed;
}

html.dark-mode .feza-shortcuts-key kbd,
body.dark-mode .feza-shortcuts-key kbd {
  background: #383838;
  border-color: #444;
  color: #e8eaed;
}

html.dark-mode .feza-shortcuts-desc,
body.dark-mode .feza-shortcuts-desc {
  color: #9aa0a6;
}

html.dark-mode .feza-template-menu,
body.dark-mode .feza-template-menu {
  background: #2d2d2d;
  border-color: #444;
}

html.dark-mode .feza-template-item,
body.dark-mode .feza-template-item {
  color: #e8eaed;
}

html.dark-mode .feza-template-item:hover,
body.dark-mode .feza-template-item:hover {
  background: #383838;
}

html.dark-mode .feza-ai-quick-btn,
body.dark-mode .feza-ai-quick-btn {
  background: rgba(26, 115, 232, 0.18);
  color: #8ab4f8;
}

html.dark-mode .feza-ai-quick-btn:hover,
body.dark-mode .feza-ai-quick-btn:hover {
  background: rgba(26, 115, 232, 0.28);
}

html.dark-mode .feza-ai-typing,
body.dark-mode .feza-ai-typing {
  background: #383838;
}

html.dark-mode .feza-welcome-toast,
body.dark-mode .feza-welcome-toast {
  background: #e8eaed;
  color: #202124;
}

/* ==========================================================================
   END — Feza Logistics Roundcube Theme v4
   ========================================================================== */

