@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/vazirmatn-arabic-400-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F;
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/vazirmatn-arabic-500-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F;
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/vazirmatn-arabic-600-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F;
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/vazirmatn-arabic-700-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F;
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/vazirmatn-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F;
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/vazirmatn-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F;
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/vazirmatn-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F;
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/vazirmatn-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F;
}

:root {
  --navy-950: #0a1b33;
  --navy-800: #12294c;
  --blue-700: #1d3f7a;
  --blue-600: #2a56b8;
  --blue-500: #3568d4;
  --blue-100: #e7edfb;
  --blue-050: #f3f6fd;
  --orange-600: #e0690f;
  --orange-500: #f2811f;
  --orange-100: #fde7d2;
  --surface: #ffffff;
  --page-bg: #f4f6fb;
  --border: #e2e7f1;
  --border-soft: #edf0f7;
  --text-strong: #0d1b30;
  --text: #2c3a52;
  --text-muted: #6b7a94;
  --text-faint: #98a4ba;
  --success: #1c8a5b;
  --danger: #d64545;
  --danger-100: #fde8e8;
  --shadow-sm: 0 1px 2px rgba(13, 27, 48, 0.06);
  --shadow-md: 0 6px 20px rgba(13, 27, 48, 0.08);
  --shadow-lg: 0 20px 48px rgba(13, 27, 48, 0.16);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --header-h: 64px;
  --table-header-h: 44px;
  --table-input-row-h: 58px;
  --font: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--page-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01' 1;
}

::selection {
  background: var(--orange-100);
  color: var(--navy-950);
}

button {
  font-family: inherit;
}

a {
  color: var(--blue-600);
}

:focus-visible {
  outline: 2px solid var(--orange-500);
  outline-offset: 2px;
  border-radius: 4px;
}

input,
button,
textarea {
  font-family: inherit;
}

/* ---------- App shell ---------- */

html,
body {
  overflow: hidden;
}

.app-shell {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header / nav ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  padding: 0 20px;
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(180deg, var(--navy-950), var(--navy-800));
  box-shadow: var(--shadow-md);
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  box-shadow: 0 4px 10px rgba(224, 105, 15, 0.45);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.01em;
}

.brand-subtitle {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
}

.topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.topbar-search input {
  width: 100%;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 0 42px 0 16px;
  font-size: 14px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.topbar-search input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.topbar-search input:focus {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(242, 129, 31, 0.7);
  outline: none;
}

.topbar-search .search-icon {
  position: absolute;
  inset-inline-end: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.6);
  pointer-events: none;
  display: flex;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
}

.icon-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}

.icon-btn:active {
  transform: scale(0.97);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.user-menu {
  position: relative;
}

.user-chip {
  height: 38px;
  padding: 0 8px 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  min-width: 190px;
  padding: 8px;
  display: none;
  z-index: 50;
}

.user-dropdown.open {
  display: block;
}

.user-dropdown button {
  width: 100%;
  text-align: start;
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: none;
  color: var(--text-strong);
  font-size: 13.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-dropdown button:hover {
  background: var(--blue-050);
}

.user-dropdown button.danger {
  color: var(--danger);
}

.user-dropdown button.danger:hover {
  background: var(--danger-100);
}

.mobile-menu-toggle {
  display: none;
}

/* ---------- Main content ---------- */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px clamp(12px, 4vw, 32px) calc(env(safe-area-inset-bottom) + 20px);
  gap: 14px;
}

.table-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.table-scroll {
  overflow: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

table.log-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 720px;
}

.log-table thead tr.header-row th {
  position: sticky;
  top: 0;
  z-index: 21;
  height: var(--table-header-h);
  background: var(--blue-050);
  color: var(--navy-800);
  font-size: 12.5px;
  font-weight: 700;
  text-align: start;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  box-shadow: 0 1px 0 var(--border);
}

.log-table thead tr.input-row td {
  position: sticky;
  top: var(--table-header-h);
  z-index: 19;
  height: var(--table-input-row-h);
  box-shadow: 0 2px 6px rgba(13, 27, 48, 0.06);
}

/* Column widths: ردیف/تاریخ/ساعت stay compact, موضوع takes the room */
.col-index {
  width: 56px;
}
.col-date {
  width: 108px;
}
.col-time {
  width: 76px;
}
.col-person {
  width: 200px;
}
.col-subject {
  width: auto;
}
.col-actions {
  width: 84px;
}

.log-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 14px;
  color: var(--text);
  vertical-align: top;
}

.log-table tbody tr {
  transition: background 0.12s ease;
}

.log-table tbody tr:nth-child(even) {
  background: #fbfcfe;
}

.log-table tbody tr:hover {
  background: var(--blue-050);
}

.log-table tbody tr.row-flash {
  animation: row-flash 1.2s ease;
}

@keyframes row-flash {
  0% {
    background: var(--orange-100);
  }
  100% {
    background: transparent;
  }
}

.cell-index {
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  position: relative;
}

/* Signature "ledger rail": a slim accent rule that runs through the row
   index column across header, input row, and every data row. */
.cell-index::before,
th.col-index::before {
  content: '';
  position: absolute;
  inset-inline-end: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--orange-500);
  opacity: 0.55;
}

.cell-date,
.cell-time {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  white-space: nowrap;
}

.cell-time {
  color: var(--text-faint);
}

.cell-person {
  font-weight: 600;
  color: var(--navy-800);
}

.cell-person .person-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cell-person .avatar-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cell-subject {
  color: var(--text);
  line-height: 1.6;
  word-break: break-word;
}

.attachment-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-inline-start: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--blue-050);
  color: var(--blue-600);
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}

.row-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.log-table tbody tr:hover .row-actions,
.log-table tbody tr:focus-within .row-actions {
  opacity: 1;
}

.row-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.row-action-btn:hover {
  background: var(--blue-050);
  color: var(--blue-600);
  border-color: var(--blue-100);
}

.row-action-btn.delete:hover {
  background: var(--danger-100);
  color: var(--danger);
  border-color: #f3c9c9;
}

.row-action-btn svg {
  width: 15px;
  height: 15px;
}

/* ---------- Input row ---------- */

.input-row td {
  padding: 8px 16px;
  background: linear-gradient(180deg, #fffaf4, #fffefb);
  border-bottom: 2px solid var(--orange-100);
  vertical-align: middle;
}

.input-row .cell-index {
  color: var(--orange-600);
  font-weight: 700;
}

.input-row .cell-index::before {
  opacity: 1;
}

.input-row .cell-date,
.input-row .cell-time {
  color: var(--text-faint);
  font-size: 12.5px;
}

.field-wrap {
  position: relative;
}

.field-input {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: #fff;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text-strong);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.field-input::placeholder {
  color: var(--text-faint);
}

.field-input:focus {
  outline: none;
  border-color: var(--orange-500);
  box-shadow: 0 0 0 3px rgba(242, 129, 31, 0.14);
}

.input-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.save-btn {
  height: 40px;
  width: 100%;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 6px 16px rgba(224, 105, 15, 0.28);
  transition: transform 0.1s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.save-btn:hover {
  box-shadow: 0 8px 20px rgba(224, 105, 15, 0.36);
}

.save-btn:active {
  transform: scale(0.97);
}

.save-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.save-btn svg {
  width: 15px;
  height: 15px;
}

/* ---------- Autocomplete ---------- */

.autocomplete-panel {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-start: 0;
  min-width: 220px;
  width: max-content;
  max-width: 320px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 60;
  max-height: 260px;
  overflow-y: auto;
}

.autocomplete-item {
  padding: 9px 14px;
  font-size: 13.5px;
  color: var(--text-strong);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.autocomplete-item strong {
  color: var(--blue-600);
  font-weight: 700;
}

.autocomplete-item.active,
.autocomplete-item:hover {
  background: var(--blue-050);
}

.autocomplete-empty {
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* ---------- Toolbar (mobile search + pagination) ---------- */

.toolbar {
  display: none;
  gap: 10px;
}

.pagination {
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 10px;
}

.pagination[hidden] {
  display: none;
}

.pagination:not([hidden]) {
  display: flex;
}

.pagination-controls {
  display: flex;
  gap: 6px;
}

.pager-btn {
  height: 32px;
  min-width: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
}

.pager-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pager-btn:not(:disabled):hover {
  border-color: var(--blue-500);
  color: var(--blue-600);
}

.pager-current {
  cursor: default;
  font-weight: 600;
  color: var(--navy-800);
}

/* ---------- Empty state ---------- */

.empty-state {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 24px;
  gap: 10px;
  color: var(--text-muted);
}

.empty-state[hidden] {
  display: none;
}

.empty-state:not([hidden]) {
  display: flex;
}

.empty-illustration {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--blue-100), var(--orange-100));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.empty-illustration svg {
  width: 38px;
  height: 38px;
  color: var(--blue-600);
}

.empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy-800);
}

.empty-subtitle {
  font-size: 13.5px;
  max-width: 320px;
  line-height: 1.7;
}

/* ---------- Toasts ---------- */

.toast-stack {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  inset-inline-end: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.toast {
  background: var(--navy-950);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in 0.22s ease;
  max-width: 320px;
}

.toast.success {
  background: linear-gradient(135deg, #14532d, #166534);
}

.toast.error {
  background: linear-gradient(135deg, #7f1d1d, #991b1b);
}

.toast svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Modals ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 40, 0.5);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 20px;
  animation: overlay-in 0.15s ease;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-overlay:not([hidden]) {
  display: flex;
}

@keyframes overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 24px;
  animation: modal-in 0.18s ease;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal h3 {
  margin: 0 0 8px;
  font-size: 17px;
  color: var(--navy-950);
}

.modal p {
  margin: 0 0 20px;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn {
  height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--blue-500);
  color: var(--blue-600);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  box-shadow: 0 8px 18px rgba(214, 69, 69, 0.32);
}

.btn-primary {
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  color: #fff;
}

.btn-primary:hover {
  box-shadow: 0 8px 18px rgba(42, 86, 184, 0.32);
}

.file-drop {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 16px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.file-drop:hover {
  border-color: var(--blue-500);
  background: var(--blue-050);
}

.file-drop.has-file {
  border-color: var(--success);
  color: var(--success);
  background: #f0faf5;
}

.file-drop.has-error {
  border-color: var(--danger);
  color: #9c2b2b;
  background: var(--danger-100);
  font-weight: 600;
}

/* ---------- Login page ---------- */

.login-shell {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 10%, #163464 0%, var(--navy-950) 55%, #061024 100%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 30px;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--orange-500), var(--blue-600));
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  text-align: center;
}

.login-brand .brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 20px;
}

.login-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--navy-950);
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  height: 44px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  padding: 0 14px;
  font-size: 14.5px;
  color: var(--text-strong);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px var(--blue-100);
}

.attachments-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 8px;
}

.attachments-empty {
  font-size: 12.5px;
  color: var(--text-faint);
  padding: 6px 2px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: var(--page-bg);
  border: 1px solid var(--border-soft);
}

.attachment-icon {
  display: flex;
  color: var(--blue-600);
  flex-shrink: 0;
}

.attachment-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text-strong);
  text-decoration: none;
}

.attachment-name:hover {
  text-decoration: underline;
  color: var(--blue-600);
}

.attachment-size {
  flex-shrink: 0;
  font-size: 11.5px;
  color: var(--text-faint);
}

.attachment-remove {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
}

.attachment-remove:hover {
  background: var(--danger-100);
  color: var(--danger);
}

.attachment-remove.confirming {
  background: var(--danger);
  color: #fff;
}

.attachments-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1.5px dashed var(--border);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease;
}

.attachments-add-btn:hover {
  border-color: var(--blue-500);
  color: var(--blue-600);
}

.login-submit {
  width: 100%;
  height: 46px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  color: #fff;
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  margin-top: 6px;
  box-shadow: 0 10px 24px rgba(42, 86, 184, 0.32);
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.login-submit:active {
  transform: scale(0.98);
}

.login-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-error {
  background: var(--danger-100);
  color: #9c2b2b;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  margin-bottom: 16px;
  display: none;
  align-items: center;
  gap: 8px;
}

.login-error.show {
  display: flex;
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .topbar-search {
    display: none;
  }

  .toolbar {
    display: flex;
  }

  .toolbar-search {
    flex: 1;
    position: relative;
  }

  .toolbar-search input {
    width: 100%;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 0 40px 0 14px;
    font-size: 14px;
  }

  .toolbar-search .search-icon {
    position: absolute;
    inset-inline-end: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    display: flex;
  }

  .icon-btn span.label-text {
    display: none;
  }

  .icon-btn {
    padding: 0 10px;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 12px 10px calc(env(safe-area-inset-bottom) + 12px);
  }

  table.log-table {
    min-width: 0;
    table-layout: fixed;
  }

  .col-date,
  .col-time,
  .cell-date,
  .cell-time {
    display: none;
  }

  .log-table thead th,
  .log-table tbody td {
    padding: 12px 10px;
  }

  .col-index {
    width: 8%;
  }

  .col-person {
    width: 24%;
  }

  .col-subject {
    width: 49%;
  }

  .col-actions {
    width: 19%;
  }

  .row-actions {
    gap: 3px;
  }

  .row-action-btn {
    width: 26px;
    height: 26px;
  }

  .row-action-btn svg {
    width: 13px;
    height: 13px;
  }

  .cell-person .person-pill {
    flex-wrap: wrap;
  }

  .cell-subject {
    font-size: 13.5px;
    word-break: break-word;
  }

  .row-actions {
    opacity: 1;
  }

  .input-row td {
    padding: 8px 8px;
  }

  .save-btn span.label-text {
    display: none;
  }
}

@media (max-width: 480px) {
  .brand-subtitle {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
