:root {
  --bg-dark: #090D16;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-card-hover: rgba(31, 41, 55, 0.8);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(245, 158, 11, 0.3);
  
  --primary-gold: #F59E0B;
  --primary-gold-dark: #D97706;
  --accent-emerald: #10B981;
  --accent-cyan: #06B6D4;
  --accent-blue: #3B82F6;
  
  --text-main: #F9FAFB;
  --text-muted: #9CA3AF;
  --text-sub: #6B7280;
  
  --font-heading: 'Segoe UI', Arial, sans-serif;
  --font-body: 'Segoe UI', Arial, sans-serif;

  --nav-height: 126px;
  --mobile-bottom-bar-height: 65px;
}
.internal-chat-attachment{margin-top:6px;display:flex;align-items:center;justify-content:space-between;gap:12px;max-width:min(100%,620px);padding:10px 12px;border:1px solid rgba(56,189,248,.3);border-radius:12px;background:rgba(8,15,28,.88)}.internal-chat-attachment>span{display:flex;flex-direction:column;min-width:0}.internal-chat-attachment b{overflow-wrap:anywhere}.internal-chat-attachment small{color:var(--text-muted);margin-top:2px}.internal-chat-attachment>div{display:flex;gap:7px;flex-wrap:wrap}.internal-chat-attachment a{white-space:nowrap;text-decoration:none}.mine .internal-chat-attachment{border-color:rgba(251,191,36,.45);background:rgba(30,41,59,.94)}
@media(max-width:600px){.internal-chat-attachment{width:100%;align-items:stretch;flex-direction:column}.internal-chat-attachment>div{display:grid;grid-template-columns:1fr 1fr}.internal-chat-attachment a{text-align:center}}

/* Keep chart values crisp: depth is drawn around the donut, never by flattening its face. */
.futuristic-stat .donut{width:150px;isolation:isolate;transform:translateZ(0);box-shadow:0 18px 28px rgba(0,0,0,.48),0 0 30px rgba(34,211,238,.28),inset 0 0 10px rgba(255,255,255,.18);animation:crisp-donut-float 5s ease-in-out infinite}
.futuristic-stat .donut::before{content:"";position:absolute;z-index:-1;inset:-11px;border:2px solid rgba(34,211,238,.38);border-left-color:rgba(168,85,247,.65);border-right-color:rgba(14,165,233,.12);border-radius:50%;filter:drop-shadow(0 0 8px rgba(34,211,238,.45));animation:holo-ring 8s linear infinite}
.futuristic-stat .donut::after{inset:23px;background:radial-gradient(circle at 38% 32%,#1e3a5f 0,#111827 48%,#050914 100%);box-shadow:inset 0 3px 8px rgba(255,255,255,.08),inset 0 -8px 16px rgba(0,0,0,.55)}
.futuristic-stat .donut b{z-index:2;transform:none;color:#fff;font-size:1.45rem;font-weight:800;line-height:1;text-shadow:0 0 5px rgba(255,255,255,.65),0 0 14px rgba(34,211,238,.8);font-variant-numeric:tabular-nums}
.holo-donut-summary{justify-content:center;min-height:260px}.holo-donut-summary .donut{width:190px}.holo-donut-summary .donut::after{inset:29px}.holo-donut-summary .donut b{font-size:1.8rem}
@keyframes crisp-donut-float{50%{transform:translateY(-6px) scale(1.015);filter:brightness(1.08)}}
@media(max-width:560px){.futuristic-stat .donut{width:138px}.holo-donut-summary .donut{width:165px}.holo-donut-summary{min-height:220px}}
@media(prefers-reduced-motion:reduce){.futuristic-stat .donut{animation:none!important}}

/* Keep these overrides last: older mobile rules above must not win. */
@media (max-width: 900px) {
  .header {
    height: var(--mobile-header-height);
    min-height: var(--mobile-header-height);
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "brand" "user";
    grid-template-rows: 68px 50px;
    padding: env(safe-area-inset-top) 14px 0;
  }
  .brand { width: 100%; min-width: 0; }
  .brand-title {
    width: auto;
    max-width: calc(100vw - 102px);
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .user-area {
    width: 100%;
    justify-content: flex-end;
    overflow-x: auto;
    padding: 4px 0 7px;
  }
  .app-container {
    height: auto;
    min-height: calc(100dvh - var(--mobile-header-height));
    overflow: visible;
    padding: 14px 12px calc(var(--mobile-bottom-bar-height) + env(safe-area-inset-bottom) + 18px);
  }
  .view-panel,
  .workspace-panel,
  .chat-wrapper,
  .chat-panel,
  .ai-chat-layout {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .document-grid {
    flex: none;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: auto;
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .document-card,
  .law-card,
  .profile-card {
    height: auto;
    min-height: 0;
    max-height: none;
    transform: none !important;
  }
  .message-list,
  .chat-messages,
  .ai-messages {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(8, minmax(68px, 1fr));
    gap: 0;
    height: calc(var(--mobile-bottom-bar-height) + env(safe-area-inset-bottom));
    padding: 5px 8px env(safe-area-inset-bottom);
    overflow-x: auto;
    overflow-y: hidden;
  }
  .mobile-nav-btn {
    min-width: 68px;
    width: auto;
    height: 100%;
    padding: 5px 3px;
    white-space: normal;
  }
}

@media (max-width: 520px) {
  .header {
    grid-template-rows: 64px 48px;
    padding-left: 10px;
    padding-right: 10px;
  }
  .brand-title { max-width: calc(100vw - 78px); }
  .user-area { justify-content: flex-start; }
  .app-container { padding-left: 9px; padding-right: 9px; }
  .mobile-bottom-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, 1fr);
    overflow: hidden;
    padding: 4px 5px calc(env(safe-area-inset-bottom) + 3px);
  }
  .mobile-nav-btn { min-width: 0; padding: 3px 2px; }
}

/* Mobile/tablet responsive layer. Desktop layout above 900px is unchanged. */
@media (max-width: 900px) {
  :root {
    --mobile-header-height: 118px;
    --mobile-bottom-bar-height: 76px;
  }

  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .header {
    position: relative;
    z-index: 220;
    width: 100%;
    height: var(--mobile-header-height);
    min-height: var(--mobile-header-height);
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "brand"
      "user";
    grid-template-rows: 68px 50px;
    gap: 0;
    padding: env(safe-area-inset-top) 14px 0;
  }

  .brand {
    grid-area: brand;
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    overflow: hidden;
  }

  .brand > div {
    min-width: 0;
    max-width: 100%;
  }

  .brand-logo {
    flex: 0 0 auto;
    width: 54px;
    height: 54px;
    object-fit: contain;
  }

  .brand-title {
    width: auto;
    max-width: calc(100vw - 102px);
    margin-left: 10px;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: clamp(1rem, 4.4vw, 1.45rem);
    line-height: 1.12;
  }

  .brand-subtitle,
  .nav-tabs,
  .status-badge {
    display: none !important;
  }

  .user-area {
    grid-area: user;
    width: 100%;
    min-width: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 0 7px;
    scrollbar-width: none;
  }

  .user-area::-webkit-scrollbar {
    display: none;
  }

  .user-area > * {
    flex: 0 0 auto;
    min-width: 0;
  }

  .user-area button,
  .user-area .btn,
  .user-area .header-action {
    padding: 7px 10px;
    font-size: .78rem;
    line-height: 1.15;
    white-space: nowrap;
  }

  .app-container {
    width: 100%;
    height: auto;
    min-height: calc(100vh - var(--mobile-header-height));
    min-height: calc(100dvh - var(--mobile-header-height));
    overflow: visible;
    padding: 14px 12px calc(var(--mobile-bottom-bar-height) + env(safe-area-inset-bottom) + 18px);
  }

  .view-panel,
  .workspace-panel,
  .chat-wrapper,
  .chat-panel,
  .ai-chat-layout {
    width: 100%;
    min-width: 0;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .view-panel.active {
    min-height: calc(100vh - var(--mobile-header-height) - var(--mobile-bottom-bar-height));
    min-height: calc(100dvh - var(--mobile-header-height) - var(--mobile-bottom-bar-height));
  }

  .document-grid {
    display: grid;
    flex: none;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: auto;
    width: 100%;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
    align-items: stretch;
  }

  .document-card,
  .law-card,
  .profile-card {
    position: relative;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    transform: none !important;
  }

  .document-card *,
  .law-card *,
  .profile-card * {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .document-card-footer,
  .document-actions,
  .card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .filter-tabs,
  .category-tabs,
  .quick-filters {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    padding-bottom: 5px;
  }

  .filter-tabs > *,
  .category-tabs > *,
  .quick-filters > * {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .ai-chat-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .ai-conversation-sidebar {
    width: 100%;
    max-width: none;
    max-height: 240px;
    overflow: auto;
  }

  .answer-mode-grid,
  .ai-mode-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .message-list,
  .chat-messages,
  .ai-messages {
    width: 100%;
    height: auto;
    max-height: none;
    overflow: visible;
    padding-left: 10px;
    padding-right: 10px;
  }

  .message-item,
  .chat-message,
  .ai-message {
    width: auto;
    max-width: 94%;
    min-width: 0;
  }

  .message-item *,
  .chat-message *,
  .ai-message * {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .chat-input-area,
  .ai-input-area,
  .composer-bar {
    position: sticky;
    z-index: 40;
    bottom: calc(var(--mobile-bottom-bar-height) + env(safe-area-inset-bottom));
    width: 100%;
  }

  .form-grid,
  .correspondence-filters,
  .document-form-grid,
  .case-form-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .form-grid > *,
  .correspondence-filters > *,
  .document-form-grid > *,
  .case-form-grid > * {
    grid-column: 1 / -1 !important;
    min-width: 0;
  }

  .table-wrap,
  .data-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .pagination,
  .pagination-controls {
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal-card {
    width: calc(100vw - 20px);
    height: calc(100dvh - 20px);
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    margin: 10px;
  }

  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(8, minmax(68px, 1fr));
    align-items: stretch;
    width: 100%;
    height: calc(var(--mobile-bottom-bar-height) + env(safe-area-inset-bottom));
    gap: 0;
    padding: 5px 8px env(safe-area-inset-bottom);
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
  }

  .mobile-nav-btn {
    min-width: 68px;
    width: auto;
    height: 100%;
    padding: 5px 3px;
    font-size: .68rem;
    line-height: 1.05;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .mobile-nav-btn .icon,
  .mobile-nav-btn svg {
    flex: 0 0 auto;
  }
}

@media (max-width: 520px) {
  :root {
    --mobile-header-height: 112px;
    --mobile-bottom-bar-height: 112px;
  }

  .header {
    grid-template-rows: 64px 48px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .brand-logo {
    width: 48px;
    height: 48px;
  }

  .brand-title {
    max-width: calc(100vw - 78px);
    margin-left: 8px;
    font-size: clamp(.98rem, 5vw, 1.28rem);
  }

  .user-area {
    justify-content: flex-start;
    gap: 5px;
  }

  .user-area button,
  .user-area .btn,
  .user-area .header-action {
    padding: 7px 8px;
    font-size: .72rem;
  }

  .app-container {
    padding-left: 9px;
    padding-right: 9px;
  }

  .workspace-panel,
  .panel,
  .card,
  .document-card,
  .law-card,
  .profile-card {
    border-radius: 14px;
  }

  .message-item,
  .chat-message,
  .ai-message {
    max-width: 96%;
  }

  .message-item,
  .chat-message,
  .ai-message,
  .document-card,
  .law-card,
  .profile-card {
    padding-left: 12px;
    padding-right: 12px;
  }

  .mobile-bottom-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, 1fr);
    overflow: hidden;
    padding: 4px 5px calc(env(safe-area-inset-bottom) + 3px);
  }

  .mobile-nav-btn {
    min-width: 0;
    padding: 3px 2px;
    font-size: clamp(.58rem, 2.7vw, .7rem);
  }
}
.chat-admin-viewer{margin-top:18px;padding-top:16px;border-top:1px solid var(--border-color)}.chat-admin-filters{display:grid;grid-template-columns:150px minmax(170px,1fr) minmax(170px,1fr) 155px minmax(220px,1.3fr);gap:8px;margin:12px 0}.chat-admin-filters input,.chat-admin-filters select{width:100%;min-width:0;padding:9px 10px;border:1px solid var(--border-color);border-radius:8px;background:#111827;color:#f9fafb}.admin-chat-message-list{min-height:240px;max-height:620px;overflow:auto;padding:12px;border:1px solid var(--border-color);border-radius:12px;background:#080d16}.admin-chat-message{max-width:82%;margin:8px 0;padding:10px 12px;border-radius:12px;background:#172033;border:1px solid #293548}.admin-chat-message.private{background:#102a36;border-color:#155e75}.admin-chat-message.general{background:#1f2937}.admin-chat-message header{display:flex;flex-wrap:wrap;justify-content:space-between;gap:8px;margin-bottom:6px;color:#cbd5e1;font-size:.8rem}.admin-chat-message header b{color:#67e8f9}.admin-chat-message p{margin:0;white-space:pre-wrap;overflow-wrap:anywhere;color:#f9fafb}.admin-chat-message.admin-sent{margin-left:auto}.admin-chat-pagination{margin-top:10px}@media(max-width:900px){.chat-admin-filters{grid-template-columns:1fr 1fr}.admin-chat-message{max-width:95%}}@media(max-width:560px){.chat-admin-filters{grid-template-columns:1fr}.admin-chat-message{max-width:100%}}

/* Trình so sánh văn bản trực quan */
.redline-result{min-width:0}.redline-result h4{overflow-wrap:anywhere}.redline-result h4 span{color:#38bdf8}
.comparison-view-tabs{display:flex;gap:.45rem;overflow-x:auto;margin:1rem 0;padding-bottom:.35rem}.comparison-view-tabs button{flex:0 0 auto;border:1px solid rgba(148,163,184,.22);border-radius:999px;padding:.58rem .8rem;background:#0b1220;color:#cbd5e1;font-weight:700;cursor:pointer}.comparison-view-tabs button.active{border-color:#38bdf8;background:#075985;color:#fff}
.comparison-toolbar{display:grid;grid-template-columns:minmax(180px,1fr) 170px 170px auto auto auto auto;gap:.5rem;align-items:center}.comparison-toolbar input,.comparison-toolbar select{width:100%;min-width:0;padding:.66rem .72rem;border:1px solid rgba(255,255,255,.13);border-radius:8px;background:#0b1220;color:#f9fafb}.comparison-toolbar>span{min-width:50px;text-align:center;color:#bae6fd;font-weight:700}.comparison-export-actions{display:flex;justify-content:flex-end;gap:.55rem;margin:.7rem 0}
.comparison-stat-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.7rem}.comparison-stat-grid article{display:grid;gap:.2rem;padding:1rem;border:1px solid rgba(148,163,184,.2);border-radius:11px;background:#111827}.comparison-stat-grid b{font-size:1.7rem;color:#e2e8f0}.comparison-stat-grid span{color:#94a3b8}.comparison-stat-grid .insert-stat{border-left:4px solid #22c55e}.comparison-stat-grid .delete-stat{border-left:4px solid #ef4444}.comparison-stat-grid .modify-stat{border-left:4px solid #38bdf8}
.impact-summary{margin:.8rem 0;padding:1rem;border:1px solid rgba(56,189,248,.25);border-radius:11px;background:rgba(14,165,233,.06)}.impact-summary h4{margin-bottom:.55rem}.impact-summary p{margin-top:.7rem;color:#fbbf24}.impact-chips{display:flex;flex-wrap:wrap;gap:.45rem}.impact-chips span{padding:.4rem .65rem;border-radius:999px;background:#172554;color:#bfdbfe;font-size:.82rem;font-weight:700}
.change-summary-table{display:grid;gap:.35rem;overflow-x:auto}.change-summary-head,.change-summary-row{min-width:900px;display:grid;grid-template-columns:45px 90px 1fr 1fr 1.2fr;gap:.6rem;align-items:start;padding:.65rem}.change-summary-head{color:#93c5fd;font-weight:700}.change-summary-row{border:1px solid rgba(148,163,184,.16);border-radius:9px;background:#111827;color:#e5e7eb;text-align:left;cursor:pointer}.change-summary-row:hover{border-color:#38bdf8}.change-summary-row span{overflow-wrap:anywhere}
.comparison-list{display:grid;gap:.8rem}.parallel-change,.before-after-card{overflow:hidden;border:1px solid rgba(148,163,184,.22);border-radius:11px;background:#111827;scroll-margin-top:150px}.parallel-change header,.before-after-card header{display:flex;justify-content:space-between;gap:.6rem;padding:.7rem .85rem;background:#172033}.parallel-change header span,.before-after-card header span{color:#93c5fd;font-size:.82rem}.parallel-columns{display:grid;grid-template-columns:1fr 1fr}.parallel-columns section{min-width:0;padding:.9rem}.parallel-columns h5{margin-bottom:.45rem}.parallel-columns p,.before-after-card p{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.55}.old-side,.before-line{background:#fff1f2;color:#4c0519}.new-side,.after-line{background:#f0fdf4;color:#052e16}.parallel-change footer,.before-after-card footer{padding:.7rem .85rem;border-top:1px solid rgba(148,163,184,.2);color:#cbd5e1}.before-line,.after-line{display:grid;grid-template-columns:70px 1fr;gap:.6rem;padding:.85rem}.before-line strong{color:#b91c1c}.after-line strong{color:#047857}.current-change{outline:3px solid #f59e0b;box-shadow:0 0 0 6px rgba(245,158,11,.15)}
.new-document-view{max-width:900px;margin:auto;padding:1.5rem;border-radius:12px;background:#fff;color:#111827}.new-document-view>h4{text-align:center;margin-bottom:1.2rem}.new-doc-paragraph{position:relative;display:grid;grid-template-columns:30px minmax(0,1fr) auto;gap:.55rem;align-items:start;margin:.45rem 0;padding:.65rem;border-left:4px solid #0ea5e9;background:#eff6ff;scroll-margin-top:150px}.new-doc-paragraph.insert{border-color:#16a34a;background:#f0fdf4}.new-doc-paragraph i{font:bold 1.1rem monospace;color:#0369a1}.new-doc-paragraph p,.unchanged-paragraph{white-space:pre-wrap;line-height:1.65}.new-doc-paragraph button{border:0;background:transparent;color:#0369a1;text-decoration:underline;cursor:pointer}.old-popover{grid-column:2/-1;padding:.65rem;border-radius:8px;background:#fff1f2;color:#991b1b}.unchanged-paragraph{margin:.45rem 0}.redline-legend{display:flex;gap:.55rem;flex-wrap:wrap}.redline-legend span{padding:.35rem .55rem;border-radius:6px}.redline-legend .delete{background:#fee2e2;color:#991b1b;text-decoration:line-through}.redline-legend .insert{background:#dcfce7;color:#166534;text-decoration:underline}
@media (max-width:1100px){.comparison-toolbar{grid-template-columns:1fr 1fr 1fr}.comparison-toolbar input{grid-column:1/-1}}
@media (max-width:720px){.comparison-toolbar{grid-template-columns:1fr 1fr}.comparison-toolbar input,.comparison-toolbar select{grid-column:1/-1}.comparison-stat-grid{grid-template-columns:1fr 1fr}.parallel-columns{grid-template-columns:1fr}.before-line,.after-line{grid-template-columns:1fr}.comparison-export-actions{flex-direction:column}.comparison-export-actions button{width:100%}.new-document-view{padding:.85rem}.new-doc-paragraph{grid-template-columns:24px minmax(0,1fr)}.new-doc-paragraph button{grid-column:2}.redline-panel{padding:.75rem}}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
[hidden]{display:none!important}

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(245, 158, 11, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(16, 185, 129, 0.05) 0%, transparent 40%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header Styles */
.header {
  min-height: var(--nav-height);
  border-bottom: 1px solid var(--border-color);
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  grid-template-areas: "brand user" "nav nav";
  grid-template-rows: 66px 52px;
  align-items: center;
  column-gap: 1rem;
  padding: 0 1.5rem 8px;
}

.brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand > div{display:flex;align-items:baseline;gap:.75rem;min-width:0}.brand-title{white-space:nowrap}.brand-subtitle{white-space:nowrap}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-dark));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}
.brand-logo{width:46px;height:46px;flex:0 0 46px;object-fit:contain;background:transparent;border:0;padding:0;box-shadow:none}.login-brand-logo{width:82px;height:82px;margin:auto;flex-basis:82px;padding:0}.login-footer{margin-top:.35rem;padding-top:.8rem;border-top:1px solid rgba(255,255,255,.08);line-height:1.45}.site-footer{width:100%;margin-top:auto;padding:18px 24px calc(18px + env(safe-area-inset-bottom));border-top:1px solid rgba(255,255,255,.08);background:rgba(9,13,22,.72);color:var(--text-muted);text-align:center;font-size:.86rem;letter-spacing:.01em}

/* Trao đổi nội bộ */
.exchange-workspace{max-width:1500px}.exchange-heading{margin-bottom:14px}.exchange-layout{display:grid;grid-template-columns:290px minmax(0,1fr);min-height:650px;border:1px solid rgba(148,163,184,.2);border-radius:18px;overflow:hidden;background:rgba(8,15,28,.68)}.exchange-sidebar{padding:14px;border-right:1px solid rgba(148,163,184,.18);background:rgba(15,23,42,.72);min-width:0}.chat-channel,.chat-user-item{width:100%;border:1px solid transparent;background:transparent;color:var(--text-primary);display:flex;align-items:center;gap:10px;text-align:left;border-radius:12px;padding:11px;cursor:pointer}.chat-channel:hover,.chat-user-item:hover,.chat-channel.active,.chat-user-item.active{background:rgba(14,165,233,.12);border-color:rgba(56,189,248,.28)}.chat-channel-icon{font-size:1.3rem}.chat-channel span:last-child,.chat-user-main{display:flex;flex-direction:column;min-width:0}.chat-channel small,.chat-user-item small{color:var(--text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-user-search{margin:14px 0 8px}.chat-user-search input,.chat-history-search input{width:100%}.chat-user-list{display:flex;flex-direction:column;gap:3px;max-height:540px;overflow:auto}.chat-user-avatar{width:36px;height:36px;flex:0 0 36px;display:grid;place-items:center;border-radius:50%;background:linear-gradient(135deg,#0369a1,#38bdf8);color:#fff;font-weight:800}.chat-user-main{flex:1}.chat-online-dot{width:9px;height:9px;flex:0 0 9px;border-radius:50%;background:#64748b}.chat-online-dot.online{background:#22c55e;box-shadow:0 0 0 3px rgba(34,197,94,.14)}.exchange-chat-panel{display:grid;grid-template-rows:auto auto minmax(280px,1fr) auto auto auto;min-width:0}.exchange-chat-header{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:15px 18px;border-bottom:1px solid rgba(148,163,184,.16)}.exchange-chat-header h3{margin:0}.exchange-chat-header small{color:var(--text-muted)}.chat-font-control{display:flex;align-items:center;gap:8px;white-space:nowrap}.chat-font-control select{width:auto}.chat-history-search{display:flex;align-items:center;gap:12px;padding:10px 18px;border-bottom:1px solid rgba(148,163,184,.12)}.chat-history-search span{color:var(--text-muted);font-size:.83rem;white-space:nowrap}.exchange-message-list{padding:18px;overflow:auto;display:flex;flex-direction:column;gap:10px;scroll-behavior:smooth}.exchange-message-list.chat-font-normal{font-size:1rem}.exchange-message-list.chat-font-large{font-size:1.22rem}.exchange-message-list.chat-font-xlarge{font-size:1.48rem}.chat-date-divider{text-align:center;color:var(--text-muted);font-size:.78em;margin:7px 0}.internal-chat-message{display:flex;flex-direction:column;align-items:flex-start;max-width:min(78%,760px)}.internal-chat-message.mine{align-self:flex-end;align-items:flex-end}.internal-chat-message.mentioned .internal-message-bubble{border-color:#f59e0b;box-shadow:0 0 0 2px rgba(245,158,11,.12)}.internal-message-meta{font-size:.78em;color:var(--text-muted);margin:0 8px 4px}.internal-message-bubble{white-space:pre-wrap;overflow-wrap:anywhere;padding:.72em .9em;border:1px solid rgba(148,163,184,.2);border-radius:16px 16px 16px 4px;background:rgba(30,41,59,.92);line-height:1.55}.mine .internal-message-bubble{background:linear-gradient(135deg,#0369a1,#0284c7);border-color:rgba(125,211,252,.42);color:white;border-radius:16px 16px 4px 16px}.chat-empty-state{margin:auto;color:var(--text-muted);text-align:center}.chat-ban-notice{margin:8px 18px 0;padding:10px 13px;border:1px solid rgba(245,158,11,.4);border-radius:10px;background:rgba(245,158,11,.1);color:#fbbf24}.emoji-palette,.mention-palette{display:flex;flex-wrap:wrap;gap:7px;margin:8px 18px 0;padding:10px;border:1px solid rgba(56,189,248,.25);border-radius:12px;background:#111c30}.emoji-palette button,.mention-palette button,.composer-tools button{border:1px solid rgba(148,163,184,.24);border-radius:9px;background:rgba(30,41,59,.9);color:var(--text-primary);cursor:pointer}.emoji-palette button{font-size:1.25rem;padding:6px}.mention-palette button{padding:7px 9px}.exchange-composer{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:10px;padding:12px 18px;border-top:1px solid rgba(148,163,184,.16)}.composer-tools{display:flex;align-items:flex-end;gap:5px}.composer-tools button{width:38px;height:38px;font-weight:800;font-size:1rem}.composer-tools button.listening{background:#b91c1c;animation:pulseMic 1s infinite}.exchange-composer textarea{resize:vertical;min-height:58px;max-height:180px}.chat-send-button{align-self:end}.chat-composer-status{min-height:24px;padding:0 18px 8px;color:var(--text-muted);font-size:.84rem}.chat-admin-panel{margin-top:18px;padding:16px;border:1px solid rgba(56,189,248,.22);border-radius:16px;background:rgba(8,15,28,.62)}.chat-admin-grid{display:grid;grid-template-columns:1fr 1fr;gap:24px}.chat-admin-grid h4{margin:0 0 10px}.chat-admin-user-list{display:flex;flex-direction:column;gap:7px;max-height:310px;overflow:auto}.chat-admin-user{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:9px 11px;border:1px solid rgba(148,163,184,.15);border-radius:10px}.chat-admin-user span{display:flex;flex-direction:column}.chat-admin-user small,.chat-log-note{color:var(--text-muted)}.chat-admin-user button.banned{border-color:#22c55e;color:#86efac}.chat-log-note{font-size:.85rem}@keyframes pulseMic{50%{box-shadow:0 0 0 6px rgba(239,68,68,.18)}}

@media (max-width:900px){.exchange-layout{grid-template-columns:1fr;min-height:0}.exchange-sidebar{border-right:0;border-bottom:1px solid rgba(148,163,184,.18)}.chat-user-list{max-height:190px}.exchange-chat-panel{min-height:610px}.chat-admin-grid{grid-template-columns:1fr}.internal-chat-message{max-width:90%}}
@media (max-width:600px){.exchange-workspace{padding:10px}.exchange-heading{align-items:flex-start}.exchange-layout{border-radius:12px}.exchange-chat-header{align-items:flex-start;flex-direction:column}.chat-font-control{width:100%;justify-content:space-between}.exchange-composer{grid-template-columns:1fr auto}.composer-tools{grid-column:1/-1;align-items:center}.internal-chat-message{max-width:94%}.chat-history-search{align-items:stretch;flex-direction:column}.chat-history-search span{white-space:normal}.exchange-message-list.chat-font-xlarge{font-size:1.35rem}}
.chat-user-search input,.chat-history-search input,.exchange-composer textarea,.chat-font-control select{background:#0b1424;color:var(--text-primary);border:1px solid rgba(148,163,184,.28);border-radius:9px;padding:10px 12px}.chat-user-search input::placeholder,.chat-history-search input::placeholder,.exchange-composer textarea::placeholder{color:#8492a6}.exchange-composer textarea{width:100%}.chat-font-control select{padding:7px 10px}
.company-archive-filters{display:grid;grid-template-columns:minmax(150px,220px) minmax(240px,1fr) auto;gap:12px;align-items:end;margin:12px 0}.company-archive-filters label{display:flex;flex-direction:column;gap:6px;color:var(--text-muted);font-size:.84rem}.company-archive-filters select{width:100%;background:#0b1424;color:var(--text-primary);border:1px solid rgba(148,163,184,.28);border-radius:9px;padding:10px 12px}.doc-archive-meta{display:flex;flex-wrap:wrap;gap:7px;margin-top:9px}.doc-archive-meta span{display:inline-flex;align-items:center;padding:4px 8px;border-radius:999px;background:rgba(14,165,233,.1);border:1px solid rgba(56,189,248,.18);color:#bae6fd;font-size:.78rem}
@media (max-width:720px){.company-archive-filters{grid-template-columns:1fr}.company-archive-filters .btn-secondary{width:100%}}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color:#38bdf8;
  background:none;
  -webkit-background-clip:initial;
  -webkit-text-fill-color:#38bdf8;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--primary-gold);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Nav Tabs */
.nav-tabs {
  grid-area: nav;
  display: flex;
  width:100%;
  gap: 0.5rem;
  background: rgba(17, 24, 39, 0.6);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow-x:auto;
  scrollbar-width:thin;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space:nowrap;
  flex:0 0 auto;
}
.nav-count{display:inline-flex;align-items:center;justify-content:center;min-width:25px;height:22px;padding:0 7px;border-radius:999px;background:rgba(245,158,11,.16);color:#fbbf24;font-size:.75rem;font-weight:700;border:1px solid rgba(245,158,11,.24)}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(16, 185, 129, 0.15));
  color: var(--primary-gold);
  border: 1px solid var(--border-highlight);
  font-weight: 600;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.user-area{grid-area:user;display:flex;align-items:center;justify-content:flex-end;gap:.55rem}.header-action{border:1px solid rgba(255,255,255,.12);border-radius:9px;background:rgba(255,255,255,.04);color:var(--text-main);padding:.5rem .75rem;cursor:pointer;white-space:nowrap;transition:background .2s,border-color .2s,transform .2s}.header-action:hover{background:rgba(245,158,11,.12);border-color:rgba(245,158,11,.35);transform:translateY(-1px)}.header-action.danger:hover{background:rgba(239,68,68,.12);border-color:rgba(239,68,68,.35)}

.status-dot {
  width: 6px;
  height: 6px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
}

/* Main Container Layout */
.app-container {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  gap: 1.5rem;
  height: calc(100vh - var(--nav-height));
  overflow: hidden;
}

.view-panel {
  display: none;
  flex: 1;
  height: 100%;
  overflow: hidden;
}

.view-panel.active {
  display: flex;
  flex-direction: column;
}

.loading-state,
.empty-state {
  grid-column: 1 / -1;
  padding: 3rem 1rem;
  color: var(--text-muted);
  text-align: center;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.8rem;
  color: var(--text-muted);
  flex: 0 0 auto;
}

.pagination button,
.reader-controls button {
  min-width: 44px;
  min-height: 40px;
}

.pagination button {
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  background: var(--bg-card);
  cursor: pointer;
}

.pagination button:disabled { opacity: 0.4; cursor: default; }
.doc-card { text-align: left; color: inherit; font: inherit; width: 100%; }
.doc-title { margin-top: 0.6rem; }
.badge-land { color: #fbbf24; }
.badge-case { color: #fb7185; }
.badge-family { color: #c084fc; }
.badge-sample { color: #34d399; }
.badge-law { color: #60a5fa; }
.reader-controls { display: flex; gap: 0.35rem; margin-right: auto; }
.font-size-btn.active { outline: 2px solid var(--primary-gold); color: var(--primary-gold); }
.modal-body[data-reader-size="normal"] .document-paper { font-size: 1rem; }
.modal-body[data-reader-size="large"] .document-paper { font-size: 1.2rem; line-height: 1.8; }
.modal-body[data-reader-size="xlarge"] .document-paper { font-size: 1.45rem; line-height: 1.85; }
.modal-body[data-reader-size="xxlarge"] .document-paper { font-size: 1.75rem; line-height: 1.9; }
.sheet-view + .sheet-view { margin-top: 2rem; }
.sheet-view h3 { color: var(--primary-gold); margin: 0 0 0.6rem; }
.citation-button { width: calc(100% - 4rem); margin: 0.3rem 2rem; text-align: left; cursor: pointer; }
.web-citation { display:block; color:#93c5fd; text-decoration:none; }
.answer-mode-box { display:grid; grid-template-columns:1fr 1fr; gap:.7rem; padding:.8rem; border-bottom:1px solid var(--border-color); background:rgba(17,24,39,.75); }
.ai-chat-layout{display:grid;grid-template-columns:260px minmax(0,1fr);min-height:650px}.ai-conversation-sidebar{padding:12px;border-right:1px solid var(--border-color);background:rgba(9,13,22,.8);min-width:0}.ai-conversation-sidebar>.btn-primary{width:100%}.ai-conversation-heading{display:flex;justify-content:space-between;gap:8px;margin:16px 2px 9px;color:#e5e7eb}.ai-conversation-heading small{color:var(--text-muted)}.ai-conversation-list{display:grid;gap:7px;max-height:560px;overflow:auto}.ai-conversation-item{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px;width:100%;padding:9px;border:1px solid var(--border-color);border-radius:9px;background:#111827;color:#f9fafb;text-align:left}.ai-conversation-item.active{border-color:#38bdf8;background:#0c2638}.ai-conversation-open{display:grid;gap:3px;min-width:0;background:none;border:0;color:inherit;text-align:left;cursor:pointer}.ai-conversation-open b,.ai-conversation-open small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ai-conversation-open small{color:#9ca3af}.ai-conversation-delete{align-self:center;border:0;background:transparent;color:#fca5a5;font-size:1rem;cursor:pointer}.ai-conversation-main{display:flex;min-width:0;flex-direction:column}
.answer-mode-box label { display:flex; align-items:flex-start; gap:.65rem; padding:.7rem; border:1px solid var(--border-color); border-radius:10px; cursor:pointer; }
.answer-mode-box input { margin-top:.2rem; accent-color:var(--primary-gold); }
.answer-mode-box span { display:grid; gap:.2rem; }.answer-mode-box small,#templateHelp { color:var(--text-muted); font-size:.76rem; line-height:1.35; }

@media (max-width: 720px) {
  .modal-actions { flex-wrap: wrap; }
  .reader-controls { width: 100%; order: -1; margin: 0 0 0.5rem; }
  .reader-controls button { flex: 1; }
  .modal-card { touch-action: pan-x pan-y pinch-zoom; }
  .document-paper { min-width: 0; overflow-wrap: anywhere; }
  .pagination { font-size: 0.8rem; gap: 0.5rem; }
}

.login-overlay { position:fixed; inset:0; z-index:1000; display:grid; place-items:center; padding:1rem; background:radial-gradient(circle at top,rgba(245,158,11,.14),transparent 40%),#090d16; }
.login-overlay.hidden { display:none; }
.login-card { width:min(430px,100%); padding:2rem; border:1px solid var(--border-color); border-radius:18px; background:#111827; box-shadow:0 24px 80px rgba(0,0,0,.5); display:grid; gap:1rem; }
.login-card .brand-icon { margin:auto; }.login-card h2,.login-card p { text-align:center; }.login-card p,.login-card small { color:var(--text-muted); }
.login-card label,.legal-form label,.admin-create-form label { display:grid; gap:.4rem; color:#d1d5db; font-size:.9rem; }
.login-card input,.legal-form input,.legal-form select,.legal-form textarea,.admin-create-form input,.admin-create-form select,.user-table input,.user-table select { width:100%; border:1px solid rgba(255,255,255,.13); border-radius:8px; background:#0b1220; color:#f9fafb; padding:.72rem .8rem; font:inherit; }
.legal-form textarea { resize:vertical; min-height:80px; line-height:1.55; }
.form-error { min-height:1.2rem; color:#fca5a5; }.dev-login-note { text-align:center; }.user-area { display:flex; align-items:center; gap:.6rem; }.signed-in-name{max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#dbeafe;font-weight:700;padding:.45rem .65rem;border-radius:9px;background:rgba(30,64,175,.22);border:1px solid rgba(96,165,250,.25)}
.logout-btn { border:1px solid var(--border-color); border-radius:8px; background:transparent; color:var(--text-muted); padding:.4rem .65rem; cursor:pointer; }
.workspace-panel { height:100%; overflow:auto; padding:0 0 2rem; }.panel-heading { display:flex; justify-content:space-between; gap:1rem; align-items:center; margin-bottom:1rem; }.panel-heading p { color:var(--text-muted); margin-top:.25rem; }
.legal-form,.admin-create-form { display:grid; gap:1rem; }.legal-form fieldset,.admin-create-form,.role-explanation { border:1px solid var(--border-color); border-radius:12px; background:rgba(17,24,39,.7); padding:1.1rem; }
.legal-form legend { padding:0 .5rem; color:var(--primary-gold); font-weight:700; }.form-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.9rem; }.form-grid .wide { grid-column:span 2; }
.legal-form fieldset>label { margin-top:.8rem; }.form-actions { position:sticky; bottom:0; display:flex; justify-content:flex-end; gap:.7rem; padding:1rem; border:1px solid var(--border-color); border-radius:12px; background:rgba(9,13,22,.96); }
.validation-box { padding:0; border-radius:10px; }.validation-box:not(:empty) { padding:1rem; border:1px solid var(--border-color); }.validation-box.valid { color:#6ee7b7; background:rgba(16,185,129,.08); }.validation-box.invalid { color:#fca5a5; background:rgba(239,68,68,.08); }.validation-box ul { margin:.5rem 0 .8rem 1.3rem; }
.user-table-wrap { overflow:auto; margin-top:1rem; border:1px solid var(--border-color); border-radius:12px; }.user-table { width:100%; border-collapse:collapse; min-width:900px; }.user-table th,.user-table td { padding:.75rem; text-align:left; border-bottom:1px solid var(--border-color); }.user-table th { color:var(--primary-gold); background:#111827; }.role-explanation { margin-top:1rem; }.role-explanation p { color:var(--text-muted); margin-top:.5rem; }
.account-toolbar{display:grid;grid-template-columns:minmax(240px,1fr) 190px auto auto;gap:.7rem;align-items:center;margin-top:1rem}.account-toolbar .search-box{margin:0}.account-toolbar select{width:100%;border:1px solid rgba(255,255,255,.13);border-radius:8px;background:#0b1220;color:#f9fafb;padding:.72rem .8rem;font:inherit}.account-table{min-width:1180px}.account-table td{vertical-align:middle}.account-table td small{display:block}.account-actions{display:flex;align-items:center;gap:.5rem;white-space:nowrap}.role-badge,.account-status{display:inline-flex;align-items:center;border-radius:999px;padding:.32rem .62rem;font-size:.8rem;font-weight:700}.role-badge{color:#bfdbfe;background:rgba(37,99,235,.14);border:1px solid rgba(96,165,250,.25)}.role-badge.root{color:#fde68a;background:rgba(245,158,11,.12);border-color:rgba(245,158,11,.3)}.account-status.online{color:#a7f3d0;background:rgba(16,185,129,.12);border:1px solid rgba(16,185,129,.3)}.account-status.offline{color:#cbd5e1;background:rgba(100,116,139,.13);border:1px solid rgba(148,163,184,.24)}.account-status.locked{color:#fecaca;background:rgba(239,68,68,.1);border:1px solid rgba(239,68,68,.28)}.failed-login-note{margin-top:.35rem;color:#fca5a5}.account-pagination{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:.55rem;margin:1rem 0}.security-alert-panel{margin-top:1rem;padding:1rem;border:1px solid var(--border-color);border-radius:12px;background:rgba(17,24,39,.7)}.security-alert-list{display:grid;gap:.65rem}.security-alert{display:flex;justify-content:space-between;align-items:center;gap:1rem;padding:.8rem;border:1px solid rgba(245,158,11,.28);border-left:4px solid #f59e0b;border-radius:10px;background:rgba(245,158,11,.07)}.security-alert p{margin:.25rem 0;color:#e5e7eb}.security-alert small{color:var(--text-muted)}.security-safe{padding:.8rem;color:#a7f3d0;background:rgba(16,185,129,.08);border-radius:9px}
.account-edit-overlay{position:fixed;inset:0;z-index:1200;display:grid;place-items:center;padding:1rem;background:rgba(2,6,23,.78);backdrop-filter:blur(5px)}.account-edit-overlay[hidden]{display:none}.account-edit-card{width:min(760px,100%);max-height:calc(100vh - 2rem);overflow:auto;display:grid;gap:1rem;padding:1.25rem;border:1px solid rgba(148,163,184,.24);border-radius:16px;background:#111827;box-shadow:0 24px 80px rgba(0,0,0,.55)}.account-edit-header{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}.account-edit-header p{margin-top:.25rem;color:var(--text-muted)}.account-edit-card>label{display:grid;gap:.42rem;color:#e5e7eb}.account-edit-card input[type="text"],.account-edit-card input[type="password"]{width:100%;border:1px solid rgba(255,255,255,.14);border-radius:9px;background:#0b1220;color:#f9fafb;padding:.75rem .85rem;font:inherit}.account-edit-card small{display:block;color:var(--text-muted);font-weight:400;margin-top:.18rem}.account-enabled{grid-template-columns:auto 1fr!important;align-items:start;padding:.8rem;border:1px solid var(--border-color);border-radius:10px;background:rgba(15,23,42,.65)}.account-enabled input,.permission-option input{width:18px;height:18px;margin-top:.12rem;accent-color:#2563eb}.permission-editor{border:1px solid var(--border-color);border-radius:12px;padding:1rem}.permission-editor legend{padding:0 .45rem;color:var(--primary-gold);font-weight:700}.permission-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.65rem}.permission-option{display:grid;grid-template-columns:auto 1fr;align-items:start;gap:.65rem;padding:.7rem;border:1px solid rgba(148,163,184,.16);border-radius:9px;background:rgba(15,23,42,.55);color:#e5e7eb}.permission-option:has(input:checked){border-color:rgba(59,130,246,.45);background:rgba(37,99,235,.11)}.account-edit-actions{display:flex;justify-content:flex-end;gap:.7rem}.dialog-open{overflow:hidden}
.matter-filters{display:grid;grid-template-columns:1fr 190px auto;gap:.7rem;margin-bottom:1rem}.matter-filters input,.matter-filters select,.matter-form input,.matter-form select,.matter-form textarea,.matter-detail input,.matter-detail select,.matter-detail textarea,.redline-controls select{width:100%;border:1px solid rgba(255,255,255,.13);border-radius:8px;background:#0b1220;color:#f9fafb;padding:.7rem .8rem;font:inherit}.matter-layout{display:grid;grid-template-columns:310px minmax(0,1fr);gap:1rem;align-items:start}.matter-list{display:grid;gap:.6rem;max-height:calc(100vh - 250px);overflow:auto}.matter-card{display:grid;gap:.32rem;text-align:left;padding:.85rem;border:1px solid var(--border-color);border-radius:11px;background:rgba(17,24,39,.75);color:#e5e7eb;cursor:pointer}.matter-card:hover,.matter-card.active{border-color:rgba(59,130,246,.55);background:rgba(37,99,235,.12)}.matter-card span,.matter-card small{color:var(--text-muted)}.matter-code{display:inline-flex;width:max-content;padding:.2rem .5rem;border-radius:999px;background:rgba(14,165,233,.13);color:#7dd3fc!important;font:700 .76rem/1.4 monospace}.matter-detail{min-width:0;border:1px solid var(--border-color);border-radius:12px;padding:1rem;background:rgba(17,24,39,.55)}.matter-form label,.matter-link-grid label{display:grid;gap:.4rem;color:#d1d5db}.matter-metadata{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.7rem;margin:1rem 0}.matter-metadata div{padding:.7rem;border:1px solid var(--border-color);border-radius:9px}.matter-metadata dt{color:var(--text-muted);font-size:.78rem}.matter-metadata dd{margin:.3rem 0 0;overflow-wrap:anywhere}.matter-description{white-space:pre-wrap;line-height:1.6}.matter-section{margin-top:1rem;padding-top:1rem;border-top:1px solid var(--border-color)}.workflow-sources{margin:.45rem 0 1rem;color:var(--text-muted);line-height:1.6}.workflow-sources a,.legal-review a{color:#7dd3fc}.task-list{display:grid;gap:.55rem}.matter-task{display:grid;grid-template-columns:130px minmax(0,1fr) auto;gap:.65rem;align-items:start;padding:.7rem;border:1px solid var(--border-color);border-radius:9px}.matter-task.done{border-color:rgba(16,185,129,.3);background:rgba(16,185,129,.06)}.task-fields{display:grid;grid-template-columns:1fr 150px 1.5fr;gap:.45rem;margin-top:.45rem}.matter-link-grid{display:grid;grid-template-columns:1fr 1fr;gap:.8rem;margin:.7rem 0}.matter-link-grid select{min-height:190px}.timeline-list{display:grid;gap:.7rem}.timeline-list article{display:grid;grid-template-columns:110px 1fr;gap:.8rem;padding:.7rem;border-left:3px solid #0ea5e9;background:rgba(14,165,233,.06);border-radius:0 9px 9px 0}.timeline-list time{color:#7dd3fc;font-weight:700}.timeline-list p{white-space:pre-wrap;margin:.25rem 0;color:#d1d5db}.timeline-list small{color:var(--text-muted)}.legal-review-list{display:grid;gap:.65rem}.legal-review{display:flex;justify-content:space-between;gap:1rem;padding:.75rem;border:1px solid var(--border-color);border-radius:9px}.legal-review.warning{border-left:4px solid #f59e0b}.legal-review.verified{border-left:4px solid #10b981}.legal-review>div:last-child{display:flex;gap:.6rem;align-items:center;white-space:nowrap}.redline-panel{margin-top:1.2rem;padding:1rem;border:1px solid var(--border-color);border-radius:12px;background:rgba(17,24,39,.7)}.redline-controls{display:grid;grid-template-columns:1fr 1fr auto auto;gap:.7rem}.redline-result{margin-top:1rem}.redline-text{margin-top:.7rem;padding:1rem;max-height:560px;overflow:auto;white-space:pre-wrap;line-height:1.75;border:1px solid var(--border-color);border-radius:10px;background:#f8fafc;color:#111827}.redline-text .delete{color:#b91c1c;text-decoration:line-through;background:#fee2e2}.redline-text .insert{color:#075985;text-decoration:underline;background:#e0f2fe}.redline-text .equal{color:#111827}

@media (max-width:1000px){.form-grid{grid-template-columns:repeat(2,minmax(0,1fr));}.status-badge{display:none;}}
@media (max-width:720px){.form-grid{grid-template-columns:1fr}.form-grid .wide{grid-column:auto}.panel-heading{align-items:flex-start}.legal-form fieldset{padding:.8rem}.form-actions{flex-wrap:wrap}.form-actions button{flex:1;min-width:130px}.user-area{position:static;right:auto;gap:.35rem}.signed-in-name{max-width:120px;font-size:.75rem;padding:.38rem .5rem}.header-action{font-size:.75rem;padding:.42rem .55rem}.header-action.permission-admin{display:none}.brand-subtitle{display:none}.dev-login-note{display:none}.permission-grid{grid-template-columns:1fr}.account-edit-card{padding:1rem}.account-edit-actions button{flex:1}.account-toolbar{grid-template-columns:1fr}.security-alert{align-items:flex-start;flex-direction:column}.security-alert button{width:100%}}
@media (max-width:720px){.answer-mode-box{grid-template-columns:1fr;padding:.55rem}.answer-mode-box label{padding:.55rem}.ai-chat-layout{grid-template-columns:1fr}.ai-conversation-sidebar{border-right:0;border-bottom:1px solid var(--border-color)}.ai-conversation-list{display:flex;max-height:150px;overflow-x:auto}.ai-conversation-item{min-width:220px}}
@media (max-width:1050px){.matter-layout{grid-template-columns:1fr}.matter-list{grid-template-columns:repeat(2,minmax(0,1fr));max-height:none}.task-fields{grid-template-columns:1fr}.redline-controls{grid-template-columns:1fr 1fr}}
@media (max-width:720px){.matter-filters,.matter-list,.matter-metadata,.matter-link-grid,.redline-controls{grid-template-columns:1fr}.matter-task{grid-template-columns:1fr}.timeline-list article{grid-template-columns:1fr}.legal-review{flex-direction:column}.legal-review>div:last-child{white-space:normal;flex-wrap:wrap}}

/* Document Vault Section */
.vault-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.25s ease;
}

.search-input:focus {
  border-color: var(--primary-gold);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.15);
  background: rgba(17, 24, 39, 0.9);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
}

.filter-tags {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.filter-tags::-webkit-scrollbar { display: none; }

.tag-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tag-btn.active, .tag-btn:hover {
  background: rgba(245, 158, 11, 0.1);
  color: var(--primary-gold);
  border-color: rgba(245, 158, 11, 0.3);
}

.document-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1rem;
  overflow-y: auto;
  min-width: 0;
  padding-right: 4px;
  flex: 1;
}

/* Document Card */
.doc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  backdrop-filter: blur(10px);
}
.doc-card > *, .doc-card > div { min-width:0; max-width:100%; }

.doc-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-highlight);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  background: var(--bg-card-hover);
}

.doc-badge {
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.03em;
}

.badge-land { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-case { background: rgba(245, 158, 11, 0.15); color: var(--primary-gold); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-law { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-family { background: rgba(236, 72, 153, 0.15); color: #EC4899; border: 1px solid rgba(236, 72, 153, 0.3); }

.doc-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-main);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.doc-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.doc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-sub);
  min-width:0;
  gap:.75rem;
}
.doc-footer > span:first-child{flex:1 1 auto;min-width:0;overflow-wrap:anywhere;word-break:break-word}.doc-footer > span:last-child{flex:0 0 auto;white-space:nowrap}.doc-file-meta{display:grid;gap:5px}.doc-file-path{overflow-wrap:anywhere;word-break:break-word}.document-modified-date{display:block;color:#fbbf24;font-weight:650;font-size:.74rem;font-variant-numeric:tabular-nums}

.doc-action-btn {
  color: var(--primary-gold);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* AI Chat Section */
.chat-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.message-item {
  display: flex;
  gap: 0.85rem;
  max-width: 85%;
  animation: fadeIn 0.3s ease;
}

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

.message-item.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.avatar-ai {
  background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-dark));
  color: #000;
}

.avatar-user {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.msg-bubble {
  background: rgba(31, 41, 55, 0.6);
  border: 1px solid var(--border-color);
  padding: 0.9rem 1.1rem;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-main);
}

.message-item.user .msg-bubble {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.2));
  border-color: rgba(245, 158, 11, 0.4);
}

.msg-citation {
  margin-top: 0.75rem;
  padding: 0.6rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--accent-emerald);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

/* Chat Suggestions */
.chat-suggestions {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  overflow-x: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  scrollbar-width: none;
}
.chat-suggestions::-webkit-scrollbar { display: none; }

.chip-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.78rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip-btn:hover {
  background: rgba(245, 158, 11, 0.15);
  color: var(--primary-gold);
  border-color: rgba(245, 158, 11, 0.3);
}

/* Input Area */
.chat-input-area {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.75rem;
  align-items: center;
  background: rgba(15, 23, 42, 0.8);
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  color: var(--text-main);
  font-size: 0.92rem;
  outline: none;
}

.chat-input:focus {
  border-color: var(--primary-gold);
}

.send-btn {
  background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-dark));
  border: none;
  color: #000;
  font-weight: 600;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.send-btn:active {
  transform: scale(0.95);
}

/* Modal View */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #0F172A;
  border: 1px solid var(--border-highlight);
  border-radius: 18px;
  width: 100%;
  max-width: 950px;
  height: 90vh;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  animation: modalUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-gold);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  background: #0B0F19;
}

/* Document Viewers (Word Paper, Excel Grid, PDF Viewer, Image Viewer) */
.document-paper {
  background: #FFFFFF;
  color: #1E293B;
  font-family: 'Times New Roman', Times, serif;
  font-size: 1.05rem;
  line-height: 1.75;
  padding: 2.5rem 3rem;
  border-radius: 8px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.4);
  max-width: 800px;
  margin: 0 auto;
}
.catalog-picker,.legal-template-info.wide{grid-column:1/-1}
.legal-form .form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.legal-form .form-grid>*{min-width:0;max-width:100%}
.legal-form .form-grid .wide{grid-column:1/-1}
.legal-form input,.legal-form select,.legal-form textarea{min-width:0;max-width:100%}
.catalog-picker small{color:#e5e7eb;font-size:.86rem;font-weight:500;line-height:1.45}
.catalog-preview-action{display:flex;justify-content:flex-start;margin-top:10px}.catalog-preview-action button{width:auto}
.legal-template-info{display:flex;min-width:0;max-width:100%;flex-direction:column;gap:6px;padding:14px 16px;border:1px solid #93c5fd;border-radius:12px;background:#eff6ff;color:#172033;overflow-wrap:anywhere}
.legal-template-info b{font-size:1rem;color:#075985}.legal-template-info span{font-size:.88rem;font-weight:600}.legal-template-info p{margin:2px 0;color:#334155}.legal-template-info a{font-size:.85rem;color:#0369a1;text-decoration:underline}
#legalSpecialFields{min-width:0;max-width:100%;overflow:hidden;border-color:#7dd3fc;background:linear-gradient(180deg,#f8fdff,#fff)}
#legalSpecialFields legend{color:#075985;background:#f8fdff;border-radius:6px}
#legalSpecialFieldsGrid{width:100%;min-width:0;grid-template-columns:repeat(2,minmax(0,1fr))}
#legalSpecialFieldsGrid>label{min-width:0;max-width:100%;color:#111827;font-weight:700;font-size:.93rem;line-height:1.4}
#legalSpecialFieldsGrid>label.wide{grid-column:1/-1}
#legalSpecialFieldsGrid>p{grid-column:1/-1;color:#111827;font-weight:600;line-height:1.5}
#legalSpecialFieldsGrid input,#legalSpecialFieldsGrid textarea{display:block;min-width:0;max-width:100%;background:#070d18;color:#fff;border-color:#334155}
#legalSpecialFieldsGrid input::placeholder,#legalSpecialFieldsGrid textarea::placeholder{color:#cbd5e1;opacity:1}
@media (max-width:720px){.legal-form .form-grid,#legalSpecialFieldsGrid{grid-template-columns:1fr}.legal-form .form-grid .wide,#legalSpecialFieldsGrid>label.wide{grid-column:auto}}
.mail-file-actions,.mail-row-actions,.file-picker-row{display:flex;flex-wrap:wrap;align-items:center;gap:6px}.file-picker-row{margin:7px 0;color:#e5e7eb}.correspondence-file-field small{color:#cbd5e1}.current-file-note{display:block;margin-top:7px;color:#67e8f9;font-size:.88rem;overflow-wrap:anywhere}

.excel-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.excel-toolbar-title {
  color: var(--accent-emerald);
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.excel-scroll-controls {
  display: flex;
  gap: 0.5rem;
}

.excel-scroll-btn {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--border-highlight);
  color: var(--primary-gold);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 600;
}
.excel-scroll-btn:hover {
  background: var(--primary-gold);
  color: #000;
}

.excel-viewer-container {
  max-height: 65vh;
  overflow: auto !important;
  background: #1E293B;
  border-radius: 10px;
  padding: 0;
  border: 1px solid var(--border-highlight);
  position: relative;
}

.excel-viewer-container::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.excel-viewer-container::-webkit-scrollbar-track {
  background: #0F172A;
}

.excel-viewer-container::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-dark));
  border-radius: 6px;
  border: 2px solid #0F172A;
}

.excel-viewer-container::-webkit-scrollbar-thumb:hover {
  background: var(--accent-emerald);
}

.excel-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
  color: #F8FAFC;
}

.excel-table tr:nth-child(1) td {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #0F172A !important;
  color: var(--primary-gold) !important;
  font-weight: 700;
  border-bottom: 2px solid var(--primary-gold);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.excel-table td {
  border: 1px solid #334155;
  padding: 10px 14px;
  white-space: nowrap;
  max-width: 350px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.excel-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

.excel-table tr:hover td {
  background: rgba(245, 158, 11, 0.12) !important;
}

.pdf-viewer-container {
  width: 100%;
  height: 650px;
  border-radius: 8px;
  overflow: hidden;
}

.pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* IMAGE LIGHTBOX VIEWER (.png, .jpg, .jpeg, .webp) */
.image-viewer-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  background: #000000;
  border-radius: 10px;
  min-height: 400px;
}

.image-viewer-img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.modal-actions {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.9);
}
.quick-summary{flex:1;min-height:0;max-height:none;overflow:auto;padding:0 32px 28px;background:#fffdf7;color:#20242a;font-family:"Times New Roman",serif;font-size:1.08rem}.summary-heading{position:sticky;z-index:4;top:0;display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 -32px 18px;padding:16px 32px;background:#fff7df;border-bottom:1px solid #d8c59b;box-shadow:0 3px 8px rgba(60,40,10,.12)}.summary-heading h3{margin:0;color:#713b16}.summary-close-btn{border:0;border-radius:8px;padding:8px 14px;background:#b42318;color:#fff;font-weight:700;cursor:pointer;box-shadow:0 2px 6px rgba(180,35,24,.3)}.summary-close-btn:hover{background:#8f1c13}.quick-summary section{margin:16px auto;max-width:800px}.quick-summary h4{margin:0 0 8px;color:#3e2a1c}.quick-summary ul{margin:0;padding-left:24px}.quick-summary li{margin:6px 0;line-height:1.55;color:#20242a}.summary-notice{max-width:800px;margin:16px auto 0;font-style:italic;color:#5e6369}.quick-summary[data-reader-size="large"]{font-size:1.2rem}.quick-summary[data-reader-size="xlarge"]{font-size:1.4rem}.quick-summary[data-reader-size="xxlarge"]{font-size:1.65rem}.reader-controls{display:flex;align-items:center;gap:8px;white-space:nowrap}.reader-controls label{font-size:.85rem}.reader-controls select{min-width:132px;padding:8px 30px 8px 10px;border:1px solid rgba(255,255,255,.18);border-radius:8px;background:#141b29;color:#f9fafb}
.audit-file-controls{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:10px 0 20px}.audit-file-controls select{min-width:240px;flex:1;padding:10px 12px;border:1px solid rgba(255,255,255,.15);border-radius:8px;background:#141b29;color:#f9fafb}
.audit-pagination{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:8px;margin:12px 0 22px}.audit-pagination>span{min-width:150px;text-align:center;color:var(--text-muted);font-size:.9rem}.audit-pagination button:disabled{opacity:.42;cursor:not-allowed;transform:none}
.correspondence-pagination{display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap;margin:14px 0 22px}.page-number-list{display:flex;align-items:center;gap:5px;flex-wrap:wrap;justify-content:center}.page-number-btn{min-width:36px;height:36px;padding:0 9px;border:1px solid rgba(255,255,255,.12);border-radius:7px;background:#141b29;color:var(--text-main);cursor:pointer}.page-number-btn.active{border-color:#38bdf8;background:#0284c7;color:#fff;font-weight:700}.page-ellipsis{padding:0 3px;color:var(--text-muted)}.page-jump{display:flex;align-items:center;gap:6px;color:var(--text-muted);font-size:.85rem}.page-jump input{width:72px;padding:.55rem;border:1px solid rgba(255,255,255,.13);border-radius:7px;background:#0b1220;color:#fff;text-align:center}.correspondence-pagination>span{color:var(--text-muted);font-size:.85rem}.correspondence-pagination button:disabled{opacity:.42;cursor:not-allowed}
@media (max-width:600px){.audit-pagination{justify-content:space-between;gap:6px}.audit-pagination span{min-width:0;font-size:.8rem}.audit-pagination .btn-secondary{padding:.55rem .7rem}}
.pagination{flex-wrap:wrap;gap:8px}.pagination>.page-number-list{order:0}.pagination>.page-jump,.account-pagination>.page-jump,.audit-pagination>.page-jump{margin-left:4px}.pagination>span,.account-pagination>span{font-size:.85rem;color:var(--text-muted)}.account-pagination button:disabled{opacity:.42;cursor:not-allowed}
@media(max-width:600px){.pagination,.account-pagination,.audit-pagination{justify-content:center}.pagination>.page-jump,.account-pagination>.page-jump,.audit-pagination>.page-jump{width:100%;justify-content:center;margin-left:0}.pagination>span,.account-pagination>span,.audit-pagination>span{width:100%;text-align:center}.pagination>.btn-secondary,.account-pagination>.btn-secondary,.audit-pagination>.btn-secondary{padding:.5rem .65rem}.pagination .page-number-btn,.account-pagination .page-number-btn,.audit-pagination .page-number-btn{min-width:32px;height:34px;padding:0 7px}}

/* Thư viện tài liệu, tìm phiên bản và quản trị an toàn dữ liệu */
html{font-family:Inter,"Segoe UI",Arial,sans-serif;text-rendering:optimizeLegibility}
body,button,input,select,textarea{font-family:inherit}
*,*::before,*::after{box-sizing:border-box}
.view-panel,.workspace-panel,.vault-header,.document-grid,.doc-card,.doc-card>*,.panel-heading>*,.header>*,.nav-tabs,.user-area{min-width:0}
.doc-title,.doc-summary,.doc-footer span,.user-table td,.user-table th,.matter-description,.legal-review,.chat-message,.smart-picker-selection,.smart-picker-results *{overflow-wrap:anywhere;word-break:normal}
.library-dashboard{display:grid;gap:1rem;margin-bottom:1rem}
.library-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.8rem}
.library-kpis article{display:flex;flex-direction:column;gap:.25rem;padding:1rem 1.1rem;border:1px solid rgba(255,255,255,.09);border-radius:14px;background:linear-gradient(145deg,rgba(14,165,233,.12),rgba(17,24,39,.68));box-shadow:0 10px 24px rgba(0,0,0,.12)}
.library-kpis strong{font-size:clamp(1.35rem,3vw,2rem);color:#7dd3fc}.library-kpis span{color:#cbd5e1;font-size:.84rem}
.library-chart-grid{display:grid;grid-template-columns:1.35fr 1fr 1fr;gap:.8rem}
.library-chart-grid>article{padding:1rem;border:1px solid rgba(255,255,255,.08);border-radius:14px;background:rgba(15,23,42,.72);overflow:hidden}
.library-chart-grid h3{margin:0 0 .9rem;font-size:.95rem;color:#e2e8f0}
.bar-chart{display:grid;gap:.5rem}.bar-row{display:grid;grid-template-columns:minmax(90px,1fr) minmax(80px,1.6fr) 38px;gap:.55rem;align-items:center;width:100%;border:0;background:transparent;color:#cbd5e1;text-align:left;padding:.25rem;border-radius:6px;cursor:pointer}
.bar-row:hover{background:rgba(125,211,252,.08)}.bar-row>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bar-row i{height:8px;border-radius:20px;background:#1e293b;overflow:hidden}.bar-row i b{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,#0284c7,#38bdf8)}.bar-row strong{text-align:right;color:#fff}
.bar-row.display-only{cursor:default;pointer-events:none}.bar-row.display-only:hover{background:transparent}
.donut-summary{display:flex;align-items:center;gap:1rem}.donut{width:112px;aspect-ratio:1;border-radius:50%;display:grid;place-items:center;position:relative;flex:0 0 auto}.donut::after{content:"";position:absolute;inset:17px;border-radius:50%;background:#111827}.donut b{z-index:1;color:#fff;font-size:1.15rem}.donut-summary>div:last-child{display:grid;gap:.4rem}.donut-summary span{display:flex;align-items:center;gap:.4rem;color:#cbd5e1;font-size:.78rem}.donut-summary span i{width:9px;height:9px;border-radius:50%}
.futuristic-stat{position:relative;overflow:hidden;perspective:1000px;background:radial-gradient(circle at 20% 0,rgba(34,211,238,.13),transparent 34%),radial-gradient(circle at 90% 20%,rgba(168,85,247,.13),transparent 38%),rgba(5,10,22,.9)!important;border-color:rgba(34,211,238,.25)!important;box-shadow:0 18px 50px rgba(2,132,199,.1),inset 0 0 35px rgba(34,211,238,.035)}.futuristic-stat::before{content:"";position:absolute;inset:0;pointer-events:none;background:linear-gradient(110deg,transparent 20%,rgba(125,211,252,.08) 45%,transparent 70%);transform:translateX(-130%);animation:holo-scan 7s linear infinite}.futuristic-stat .library-kpis article,.correspondence-stat-kpis article{transform:perspective(700px) rotateX(4deg) translateZ(0);background:linear-gradient(145deg,rgba(8,47,73,.78),rgba(30,27,75,.68));border-color:rgba(34,211,238,.22);box-shadow:0 12px 24px rgba(0,0,0,.28),inset 0 1px rgba(255,255,255,.08);transition:transform .25s,box-shadow .25s}.futuristic-stat .library-kpis article:hover,.correspondence-stat-kpis article:hover{transform:perspective(700px) rotateX(0) translateY(-4px) scale(1.02);box-shadow:0 16px 34px rgba(34,211,238,.18)}.futuristic-stat .library-chart-grid>article,.correspondence-chart-grid>article{position:relative;background:linear-gradient(155deg,rgba(8,15,31,.94),rgba(17,24,39,.82));border:1px solid rgba(56,189,248,.2);box-shadow:inset 0 0 24px rgba(14,165,233,.04),0 14px 35px rgba(0,0,0,.22)}.futuristic-stat .bar-row i{height:12px;overflow:visible;transform:skewX(-12deg);background:#111827;box-shadow:inset 0 -3px 4px rgba(0,0,0,.55)}.futuristic-stat .bar-row i b{position:relative;background:linear-gradient(90deg,#06b6d4,#38bdf8,#818cf8);box-shadow:0 0 12px rgba(34,211,238,.58);animation:holo-bar-pulse 3.8s ease-in-out infinite}.futuristic-stat .bar-row i b::after{content:"";position:absolute;left:3px;right:3px;top:1px;height:2px;background:rgba(255,255,255,.65);filter:blur(.4px)}.futuristic-stat .donut{transform:perspective(500px) rotateX(58deg) rotateZ(0);box-shadow:0 20px 26px rgba(0,0,0,.46),0 0 25px rgba(34,211,238,.25);animation:holo-donut-float 6s ease-in-out infinite}.futuristic-stat .donut::before{content:"";position:absolute;inset:-8px;border:1px solid rgba(34,211,238,.28);border-radius:50%;animation:holo-ring 8s linear infinite}.futuristic-stat .donut b{transform:rotateX(-58deg)}
.correspondence-stat-controls{display:flex;flex-wrap:wrap;gap:8px}.correspondence-stat-controls select,.correspondence-stat-controls input{padding:8px 10px;border:1px solid rgba(56,189,248,.3);border-radius:8px;background:#071221;color:#e0f2fe}.correspondence-stat-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:12px 0}.correspondence-stat-kpis article{display:grid;gap:4px;padding:14px;border:1px solid;border-radius:12px}.correspondence-stat-kpis strong{font-size:1.35rem;color:#67e8f9}.correspondence-stat-kpis span{color:#cbd5e1;font-size:.82rem}.correspondence-chart-grid{display:grid;grid-template-columns:1.7fr 1fr;gap:12px}.correspondence-chart-grid>article{padding:14px;border-radius:14px}.correspondence-chart-grid h4{margin:0 0 12px;color:#e0f2fe}.holo-column-chart{display:flex;align-items:stretch;gap:clamp(4px,1vw,12px);height:260px;padding:20px 10px 0;border-bottom:1px solid rgba(34,211,238,.25);background:repeating-linear-gradient(to top,rgba(34,211,238,.075) 0 1px,transparent 1px 52px);overflow-x:auto;perspective:800px}.holo-column-group{display:grid;grid-template-rows:minmax(0,1fr) auto;min-width:42px;flex:1;gap:7px;text-align:center}.holo-columns{display:flex;align-items:flex-end;justify-content:center;gap:5px}.holo-column{position:relative;display:block;width:clamp(12px,1.3vw,22px);height:var(--height);min-height:3px;border-radius:4px 4px 1px 1px;transform:skewY(-3deg);transform-origin:bottom;animation:holo-column-rise .8s cubic-bezier(.2,.8,.2,1) both}.holo-column::before{content:"";position:absolute;inset:0;background:linear-gradient(90deg,rgba(255,255,255,.35),transparent 35%,rgba(0,0,0,.25));border-radius:inherit}.holo-column::after{content:"";position:absolute;left:2px;right:-5px;top:-5px;height:7px;border-radius:4px;transform:skewX(-35deg)}.holo-column.incoming{background:linear-gradient(#67e8f9,#0891b2);box-shadow:0 0 16px rgba(34,211,238,.55)}.holo-column.incoming::after{background:#a5f3fc}.holo-column.outgoing{background:linear-gradient(#c084fc,#7e22ce);box-shadow:0 0 16px rgba(168,85,247,.55)}.holo-column.outgoing::after{background:#d8b4fe}.holo-column b{position:absolute;top:-22px;left:50%;transform:translateX(-50%) skewY(3deg);font-style:normal;color:#fff;font-size:.72rem}.holo-column-group>span{font-size:.68rem;color:#94a3b8;white-space:nowrap}.holo-legend{display:flex;justify-content:center;gap:18px;margin-top:10px;color:#cbd5e1;font-size:.8rem}.holo-legend span{display:flex;align-items:center;gap:6px}.holo-legend i{width:9px;height:9px;border-radius:50%;box-shadow:0 0 9px currentColor}.holo-legend i.incoming{background:#22d3ee;color:#22d3ee}.holo-legend i.outgoing{background:#a855f7;color:#a855f7}
@keyframes holo-scan{to{transform:translateX(130%)}}@keyframes holo-bar-pulse{50%{filter:brightness(1.25);box-shadow:0 0 18px rgba(34,211,238,.8)}}@keyframes holo-donut-float{50%{transform:perspective(500px) rotateX(58deg) rotateZ(4deg) translateY(-5px)}}@keyframes holo-ring{to{transform:rotate(360deg)}}@keyframes holo-column-rise{from{height:0;filter:brightness(1.8)}}
@media(max-width:800px){.correspondence-stat-kpis{grid-template-columns:1fr 1fr}.correspondence-chart-grid{grid-template-columns:1fr}.correspondence-stat-controls{width:100%}.correspondence-stat-controls>*{flex:1;min-width:125px}}@media(prefers-reduced-motion:reduce){.futuristic-stat::before,.futuristic-stat .bar-row i b,.futuristic-stat .donut,.futuristic-stat .donut::before,.holo-column{animation:none!important}}
.smart-document-picker{position:relative;min-width:0}.smart-document-picker label{display:grid;gap:.4rem;color:#dbeafe;font-weight:600}.smart-document-picker input[type=search]{width:100%;padding:.72rem .8rem;border:1px solid rgba(255,255,255,.15);border-radius:9px;background:#0b1220;color:#fff;font:inherit}
.smart-picker-selection{display:flex;align-items:center;gap:.6rem;min-height:42px;margin-top:.45rem;padding:.55rem .65rem;border:1px dashed rgba(125,211,252,.3);border-radius:8px;color:#94a3b8}.smart-picker-selection b{color:#e2e8f0}.smart-picker-selection small{flex:1;color:#94a3b8}.smart-picker-selection button{border:0;background:rgba(239,68,68,.15);color:#fca5a5;border-radius:50%;width:26px;height:26px;cursor:pointer}
.smart-picker-results{position:absolute;z-index:30;top:68px;left:0;right:0;max-height:360px;overflow:auto;padding:.4rem;border:1px solid rgba(125,211,252,.35);border-radius:10px;background:#0b1220;box-shadow:0 20px 45px rgba(0,0,0,.5)}.smart-picker-results button{display:grid;gap:.2rem;width:100%;padding:.7rem;border:0;border-radius:7px;background:transparent;color:#e5e7eb;text-align:left;cursor:pointer}.smart-picker-results button:hover,.smart-picker-results button.active{background:rgba(14,165,233,.15)}.smart-picker-results span,.smart-picker-results small{color:#94a3b8;font-size:.78rem}
.document-monitor-panel{margin-top:1.2rem;padding-top:1.2rem;border-top:1px solid rgba(255,255,255,.1)}.monitor-tabs{display:flex;gap:.5rem;margin-bottom:.9rem}.monitor-tabs button{padding:.65rem 1rem;border:1px solid rgba(255,255,255,.1);border-radius:8px;background:#111827;color:#cbd5e1;cursor:pointer}.monitor-tabs button.active{background:#0369a1;border-color:#38bdf8;color:#fff}.monitor-toolbar{display:grid;grid-template-columns:minmax(220px,1.4fr) 180px minmax(220px,1fr) auto auto;gap:.6rem;margin-bottom:.8rem}.monitor-toolbar input,.monitor-toolbar select{width:100%;padding:.65rem .75rem;border:1px solid rgba(255,255,255,.14);border-radius:8px;background:#0b1220;color:#fff}.monitor-toolbar button{white-space:nowrap}
.document-event-list{display:grid;gap:.55rem}.document-event{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.3rem .8rem;padding:.8rem;border:1px solid rgba(255,255,255,.08);border-left:4px solid #64748b;border-radius:9px;background:rgba(15,23,42,.68)}.document-event.created{border-left-color:#22c55e}.document-event.modified{border-left-color:#f59e0b}.document-event.deleted,.document-event.deleted_by_admin{border-left-color:#ef4444}.document-event.restored{border-left-color:#38bdf8}.document-event>div{display:flex;gap:.7rem;align-items:center;grid-column:1/-1}.document-event>div span{font-weight:700;color:#f8fafc}.document-event time,.document-event small{color:#94a3b8}.document-event p{margin:.2rem 0;color:#cbd5e1}.document-event button{grid-column:2;grid-row:2/5;align-self:center}
.monitor-warning{padding:.7rem;border-left:4px solid #f59e0b;background:rgba(245,158,11,.08);color:#fde68a}.duplicate-list{display:grid;gap:.8rem}.duplicate-group{border:1px solid rgba(255,255,255,.1);border-radius:10px;overflow:hidden}.duplicate-group header,.duplicate-group>div{display:flex;align-items:center;gap:.7rem;padding:.7rem .8rem}.duplicate-group header{justify-content:space-between;background:rgba(14,165,233,.1)}.duplicate-group>div{border-top:1px solid rgba(255,255,255,.07)}.duplicate-group>div>span{display:grid;gap:.2rem;flex:1;min-width:0}.duplicate-group small{overflow-wrap:anywhere;color:#94a3b8}
.duplicate-group .duplicate-modified{color:#fbbf24;font-weight:650;font-variant-numeric:tabular-nums}
.app-dialog{width:min(760px,calc(100vw - 24px));max-height:80vh;overflow:auto;border:1px solid #334155;border-radius:14px;background:#111827;color:#e5e7eb;box-shadow:0 30px 80px rgba(0,0,0,.65)}.app-dialog::backdrop{background:rgba(2,6,23,.78)}.dialog-close{float:right;border:0;background:transparent;color:#fca5a5;font-size:1.8rem;cursor:pointer}.version-row{display:flex;align-items:center;gap:.7rem;padding:.7rem;border-top:1px solid #263244}.version-row span{display:grid;gap:.2rem;flex:1;min-width:0}.version-row small{color:#94a3b8;overflow-wrap:anywhere}
@media(max-width:1000px){.library-chart-grid{grid-template-columns:1fr 1fr}.library-chart-grid>article:first-child{grid-column:1/-1}.monitor-toolbar{grid-template-columns:1fr 1fr}.redline-controls{grid-template-columns:1fr 1fr}}
@media(max-width:720px){.library-kpis{grid-template-columns:1fr 1fr}.library-chart-grid{grid-template-columns:1fr}.library-chart-grid>article:first-child{grid-column:auto}.donut-summary{align-items:flex-start}.redline-controls,.monitor-toolbar{grid-template-columns:1fr}.smart-picker-results{position:fixed;top:15vh;left:12px;right:12px;max-height:65vh}.document-event{grid-template-columns:1fr}.document-event button{grid-column:1;grid-row:auto;width:100%}.duplicate-group>div{align-items:stretch;flex-wrap:wrap}.duplicate-group>div>span{flex-basis:100%}.version-row{align-items:stretch;flex-direction:column}.version-row button{width:100%}}
@media(max-width:420px){.library-kpis{grid-template-columns:1fr}.bar-row{grid-template-columns:minmax(90px,1fr) 1fr 34px}.donut-summary{flex-direction:column}.filter-tags{overflow-x:auto;flex-wrap:nowrap;padding-bottom:.3rem}.filter-tags .tag-btn{white-space:nowrap}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}
.ai-user-limit-list{display:grid;gap:.6rem;margin:.7rem 0 1rem}.ai-user-limit{display:grid;grid-template-columns:minmax(200px,1.4fr) repeat(4,minmax(110px,1fr));gap:.6rem;align-items:end;padding:.75rem;border:1px solid rgba(255,255,255,.09);border-radius:10px;background:rgba(15,23,42,.65)}.ai-user-limit label{display:grid;gap:.35rem;color:#cbd5e1;font-size:.82rem}.ai-user-limit input[type=number]{width:100%;padding:.6rem;border:1px solid rgba(255,255,255,.13);border-radius:7px;background:#0b1220;color:#fff}.ai-user-limit .checkbox-label{display:flex;align-items:center;gap:.6rem}.ai-user-limit .checkbox-label span{display:grid;gap:.2rem}.ai-user-limit small{color:#94a3b8}.worker-status-card{padding:1rem;margin-bottom:.8rem;border:1px solid #334155;border-left:5px solid #64748b;border-radius:10px;background:#0f172a}.worker-status-card.idle{border-left-color:#22c55e}.worker-status-card.indexing,.worker-status-card.scanning{border-left-color:#38bdf8}.worker-status-card.error,.worker-status-card.offline{border-left-color:#ef4444}.worker-status-card>div{display:flex;justify-content:space-between;gap:1rem}.worker-status-card p,.worker-status-card small{color:#94a3b8}.quarantine-list{display:grid;gap:.7rem}.quarantine-item{padding:.85rem;border:1px solid rgba(255,255,255,.09);border-left:4px solid #f59e0b;border-radius:10px;background:rgba(15,23,42,.65)}.quarantine-item>div{display:flex;align-items:center;justify-content:space-between;gap:.6rem;flex-wrap:wrap}.quarantine-item p{overflow-wrap:anywhere;color:#e2e8f0}.quarantine-item small{display:block;margin:.35rem 0 .7rem;color:#94a3b8}.quarantine-item a{text-decoration:none}.quarantine-item.retrying{border-left-color:#38bdf8}.quarantine-item.deleted{opacity:.62;border-left-color:#64748b}
.rag-automation-form{display:grid;grid-template-columns:minmax(240px,1.6fr) repeat(3,minmax(145px,1fr));gap:.75rem;align-items:end;margin:0 0 1rem;padding:1rem;border:1px solid #334155;border-radius:12px;background:rgba(15,23,42,.78)}.rag-automation-form>label{display:grid;gap:.35rem;color:#cbd5e1;font-size:.84rem}.rag-automation-form input[type=number]{width:100%;padding:.65rem;border:1px solid #475569;border-radius:8px;background:#0b1220;color:#fff}.rag-auto-toggle{display:flex!important;align-items:center;gap:.7rem}.rag-auto-toggle input{width:20px;height:20px;accent-color:#22c55e}.rag-auto-toggle span{display:grid;gap:.2rem}.rag-auto-toggle small{color:#94a3b8}.rag-automation-actions{display:flex;gap:.6rem;flex-wrap:wrap}.rag-automation-form .form-message{grid-column:1/-1;margin:0;color:#93c5fd}
@media(max-width:1000px){.ai-user-limit{grid-template-columns:1fr 1fr 1fr}.ai-user-limit .checkbox-label{grid-column:1/-1}}
@media(max-width:900px){.rag-automation-form{grid-template-columns:1fr 1fr}.rag-auto-toggle,.rag-automation-actions,.rag-automation-form .form-message{grid-column:1/-1}}@media(max-width:600px){.ai-user-limit{grid-template-columns:1fr 1fr}.ai-user-limit .checkbox-label{grid-column:1/-1}.worker-status-card>div{align-items:flex-start;flex-direction:column}.rag-automation-form{grid-template-columns:1fr}.rag-auto-toggle,.rag-automation-actions,.rag-automation-form .form-message{grid-column:auto}}
@media (max-width:600px){.correspondence-pagination{gap:6px}.correspondence-pagination>.btn-secondary{padding:.5rem .65rem}.page-number-btn{min-width:32px;height:34px}.page-jump{width:100%;justify-content:center}}
.workspace-panel,.vault-header,.document-grid,.chat-container{scrollbar-color:rgba(245,158,11,.35) transparent;scrollbar-width:thin}.workspace-panel{padding:1.1rem;border:1px solid rgba(255,255,255,.07);border-radius:16px;background:linear-gradient(180deg,rgba(17,24,39,.58),rgba(9,13,22,.42));box-shadow:0 16px 40px rgba(0,0,0,.16)}button,input,select,textarea{transition:border-color .2s ease,background-color .2s ease,box-shadow .2s ease,transform .2s ease}input:focus,select:focus,textarea:focus{outline:none;border-color:rgba(245,158,11,.55)!important;box-shadow:0 0 0 3px rgba(245,158,11,.1)}.doc-card{border-color:rgba(255,255,255,.08)}.doc-card:hover{transform:translateY(-2px);border-color:rgba(245,158,11,.28);box-shadow:0 12px 26px rgba(0,0,0,.2)}
.correspondence-filters{display:grid;grid-template-columns:150px 140px 140px minmax(190px,.7fr) minmax(260px,1fr);gap:10px;margin:14px 0}.correspondence-filters select,.correspondence-filters input{width:100%;padding:10px 12px;border:1px solid rgba(255,255,255,.12);border-radius:8px;background:#141b29;color:#f9fafb}.mail-badge{display:inline-block;padding:4px 9px;border-radius:999px;font-weight:700;font-size:.78rem}.mail-badge.incoming{background:rgba(6,182,212,.16);color:#67e8f9}.mail-badge.outgoing{background:rgba(245,158,11,.16);color:#fbbf24}.mail-file-link{display:inline-block;text-decoration:none;white-space:nowrap}.correspondence-table td{vertical-align:top}
@media (max-width:1050px){.correspondence-filters{grid-template-columns:repeat(2,minmax(0,1fr))}.correspondence-filters input:last-child{grid-column:1/-1}}
@media (max-width:600px){.correspondence-filters{grid-template-columns:1fr}.correspondence-filters input:last-child{grid-column:auto}}
.mail-content-cell{min-width:260px;max-width:520px;white-space:pre-wrap;line-height:1.45;overflow-wrap:anywhere}.admin-create-form textarea[name="content"]{min-height:220px;resize:vertical;line-height:1.5}
@media(min-width:901px){#correspondenceForm textarea[name="content"],#correspondenceForm textarea[name="notes"]{padding:14px 15px;font-size:clamp(1.25rem,1.35vw,1.55rem);line-height:1.5}}
.ai-settings-panel{margin:1.4rem 0;padding:1.1rem;border:1px solid rgba(56,189,248,.28);border-radius:14px;background:rgba(2,132,199,.06)}.ai-settings-panel .admin-create-form{margin:0}.ai-settings-panel small{color:var(--text-muted);line-height:1.4}.ai-settings-panel input[name="apiKey"]{font-family:Consolas,"Courier New",monospace}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-dark));
  border: none;
  color: #000;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  display: none;
  height: var(--mobile-bottom-bar-height);
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid var(--border-color);
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 150;
  justify-content: space-around;
  align-items: center;
  backdrop-filter: blur(10px);
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
}

.mobile-nav-btn.active {
  color: var(--primary-gold);
  font-weight: 600;
}

.mobile-nav-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.mobile-bottom-nav::-webkit-scrollbar,.filter-tags::-webkit-scrollbar{display:none}.mobile-bottom-nav,.filter-tags{scrollbar-width:none}
.rag-job-toolbar{display:grid;grid-template-columns:minmax(220px,1fr) 180px auto auto;gap:10px;margin:16px 0}.rag-job-toolbar input,.rag-job-toolbar select{min-width:0}.rag-job-summary{display:flex;flex-wrap:wrap;gap:10px;margin-bottom:12px}.rag-job-summary span{background:rgba(15,23,42,.55);border:1px solid var(--border-color);border-radius:999px;padding:7px 12px}.rag-job-list{display:grid;gap:10px;max-height:520px;overflow:auto;margin-bottom:22px}.rag-job{border:1px solid var(--border-color);border-left:4px solid #64748b;border-radius:12px;padding:12px;background:rgba(15,23,42,.45);overflow-wrap:anywhere}.rag-job>div{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}.rag-job>div span{white-space:nowrap;font-size:.82rem;font-weight:700}.rag-job p,.rag-job small{display:block;margin:6px 0;color:var(--text-muted)}.rag-job.completed{border-left-color:#22c55e}.rag-job.processing{border-left-color:#38bdf8}.rag-job.queued{border-left-color:#f59e0b}.rag-job.failed{border-left-color:#ef4444}.rag-job.failed>div span{color:#fca5a5}.rag-job button{margin-top:8px}
.admin-shell{display:grid;grid-template-columns:260px minmax(0,1fr);gap:18px;min-height:calc(100vh - 150px);align-items:start}.admin-sidebar{position:sticky;top:0;max-height:calc(100vh - 120px);overflow:auto;border:1px solid var(--border-color);border-radius:16px;background:linear-gradient(180deg,rgba(15,23,42,.98),rgba(17,24,39,.94));box-shadow:0 18px 45px rgba(0,0,0,.2);padding:10px}.admin-sidebar-heading{display:flex;align-items:center;justify-content:space-between;padding:10px 8px 14px;color:#93c5fd;font-size:.72rem;font-weight:800;letter-spacing:.09em}.admin-sidebar-heading button{width:30px;height:30px;border:1px solid var(--border-color);border-radius:8px;background:#111827;color:#cbd5e1;cursor:pointer}.admin-sidebar nav{display:grid;gap:5px}.admin-nav-item{width:100%;display:grid;grid-template-columns:30px minmax(0,1fr) auto;align-items:center;gap:9px;border:1px solid transparent;border-radius:10px;background:transparent;color:#cbd5e1;text-align:left;padding:10px;cursor:pointer;transition:.18s ease}.admin-nav-item:hover{background:rgba(37,99,235,.12);color:#fff}.admin-nav-item.active{border-color:rgba(59,130,246,.45);background:linear-gradient(90deg,rgba(37,99,235,.28),rgba(14,165,233,.1));color:#fff;box-shadow:inset 3px 0 #2997d6}.admin-nav-icon{display:grid;place-items:center;min-width:28px;height:28px;border-radius:8px;background:rgba(148,163,184,.1);font-size:.83rem;font-weight:800;color:#7dd3fc}.admin-nav-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:650}.admin-nav-item em{min-width:23px;border-radius:999px;background:#dc2626;color:#fff;text-align:center;padding:2px 6px;font-size:.72rem;font-style:normal}.admin-main{min-width:0}.admin-mobile-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;padding:10px 14px;border:1px solid var(--border-color);border-radius:12px;background:rgba(15,23,42,.75)}.admin-mobile-heading button{display:none}.admin-mobile-heading div{display:flex;align-items:baseline;gap:8px}.admin-mobile-heading small{color:var(--text-muted)}.admin-pane{min-width:0;animation:adminPaneIn .18s ease}.admin-pane[hidden]{display:none!important}.admin-pane-header{margin-bottom:12px;padding:16px 18px;border:1px solid rgba(41,151,214,.25);border-radius:14px;background:linear-gradient(120deg,rgba(37,99,235,.13),rgba(15,23,42,.78))}.admin-pane-header small{color:#7dd3fc;font-size:.7rem;font-weight:800;letter-spacing:.09em}.admin-pane-header h2{margin:4px 0 0}.admin-pane>.panel-heading:first-of-type,.admin-pane>section>.panel-heading:first-child{margin-top:0}.admin-overview-intro,.admin-backup-card,.admin-library-stat{padding:18px;border:1px solid var(--border-color);border-radius:14px;background:rgba(15,23,42,.58);margin-bottom:14px}.admin-overview-intro h3,.admin-backup-card h3{margin-top:0}.admin-overview-intro p,.admin-backup-card p{color:var(--text-muted)}.admin-backup-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:16px}.admin-library-stat .library-dashboard{margin:0}.admin-library-stat .panel-heading{margin-bottom:12px}.admin-pane .security-alert-panel,.admin-pane .ai-settings-panel,.admin-pane .document-monitor-panel,.admin-pane .chat-admin-panel{margin-top:0}.admin-shell.sidebar-collapsed{grid-template-columns:72px minmax(0,1fr)}.sidebar-collapsed .admin-sidebar-heading span,.sidebar-collapsed .admin-nav-label,.sidebar-collapsed .admin-nav-item em{display:none}.sidebar-collapsed .admin-sidebar-heading{justify-content:center}.sidebar-collapsed .admin-sidebar-heading button{transform:rotate(180deg)}.sidebar-collapsed .admin-nav-item{grid-template-columns:1fr;padding:8px}.sidebar-collapsed .admin-nav-icon{margin:auto}.admin-pane .user-table-wrap{max-width:100%}@keyframes adminPaneIn{from{opacity:.45;transform:translateY(4px)}to{opacity:1;transform:none}}

.office-admin-list{display:grid;gap:10px}.office-admin-list article{display:grid;grid-template-columns:minmax(150px,.8fr) minmax(220px,1.4fr) auto auto;gap:10px;align-items:center;padding:12px;border:1px solid var(--border-color);border-radius:12px;background:rgba(15,23,42,.5)}.office-admin-list article>div small,.office-admin-list article>small{display:block;color:var(--text-muted);overflow-wrap:anywhere}.office-admin-list article>small{grid-column:1/-1}.office-admin-list label{white-space:nowrap}
/* Media Queries for Mobile Responsiveness */
@media (max-width: 768px) {
  .header {
    min-height:70px;
    height:70px;
    grid-template-columns:1fr auto;
    grid-template-areas:"brand user";
    grid-template-rows:70px;
    padding:0 .8rem;
  }
  .nav-tabs {
    display: none;
  }
  .status-badge {
    display: none;
  }
  .app-container {
    padding: 1rem 0.75rem calc(var(--mobile-bottom-bar-height) + 0.75rem) 0.75rem;
    height: calc(100vh - 70px);
  }
  .mobile-bottom-nav {
    display: flex;
    justify-content:flex-start;
    gap:20px;
    overflow-x:auto;
    padding:0 14px;
  }
  .mobile-nav-btn{min-width:58px;flex:0 0 auto}
  .correspondence-filters{grid-template-columns:1fr 1fr}.correspondence-filters input{grid-column:1/-1}
  .rag-job-toolbar{grid-template-columns:1fr}.rag-job>div{display:block}.rag-job>div span{display:block;margin-top:4px}
  .office-admin-list article{grid-template-columns:1fr}.office-admin-list article>small{grid-column:auto}
  .admin-shell{display:block;min-height:auto}.admin-sidebar{position:fixed;z-index:260;left:0;top:70px;bottom:var(--mobile-bottom-bar-height);width:min(86vw,310px);max-height:none;border-radius:0 16px 16px 0;transform:translateX(-105%);transition:transform .2s ease;box-shadow:20px 0 45px rgba(0,0,0,.45)}.admin-shell.mobile-menu-open .admin-sidebar{transform:translateX(0)}.admin-shell.mobile-menu-open:after{content:"";position:fixed;z-index:250;inset:70px 0 var(--mobile-bottom-bar-height);background:rgba(2,6,23,.68)}.admin-mobile-heading{position:sticky;top:0;z-index:20;background:rgba(15,23,42,.96)}.admin-mobile-heading button{display:inline-flex;border:1px solid rgba(59,130,246,.45);border-radius:9px;background:rgba(37,99,235,.18);color:#e0f2fe;padding:9px 11px}.admin-mobile-heading div{display:block;text-align:right}.admin-mobile-heading small,.admin-mobile-heading b{display:block}.admin-sidebar-heading button{display:none}.admin-shell.sidebar-collapsed{display:block}.sidebar-collapsed .admin-sidebar-heading span,.sidebar-collapsed .admin-nav-label,.sidebar-collapsed .admin-nav-item em{display:initial}.sidebar-collapsed .admin-nav-item{grid-template-columns:30px minmax(0,1fr) auto;padding:10px}.sidebar-collapsed .admin-nav-icon{margin:0}.admin-pane-header{padding:13px}.admin-library-stat,.admin-overview-intro,.admin-backup-card{padding:12px}
  .document-grid {
    grid-template-columns: 1fr;
  }
  .message-item {
    max-width: 92%;
  }
  .document-paper {
    padding: 1.25rem 1rem;
    font-size: 0.95rem;
  }
  .modal-card {
    height: 95vh;
    max-height: 95vh;
    border-radius: 14px;
  }
}

/* Final donut override: preserve a perfectly round, sharp chart face. */
.futuristic-stat .donut{width:150px;isolation:isolate;transform:translateZ(0);box-shadow:0 18px 28px rgba(0,0,0,.48),0 0 30px rgba(34,211,238,.28),inset 0 0 10px rgba(255,255,255,.18);animation:crisp-donut-float 5s ease-in-out infinite}
.futuristic-stat .donut::before{content:"";position:absolute;z-index:-1;inset:-11px;border:2px solid rgba(34,211,238,.38);border-left-color:rgba(168,85,247,.65);border-right-color:rgba(14,165,233,.12);border-radius:50%;filter:drop-shadow(0 0 8px rgba(34,211,238,.45));animation:holo-ring 8s linear infinite}
.futuristic-stat .donut::after{inset:23px;background:radial-gradient(circle at 38% 32%,#1e3a5f 0,#111827 48%,#050914 100%);box-shadow:inset 0 3px 8px rgba(255,255,255,.08),inset 0 -8px 16px rgba(0,0,0,.55)}
.futuristic-stat .donut b{z-index:2;transform:none;color:#fff;font-size:1.45rem;font-weight:800;line-height:1;text-shadow:0 0 5px rgba(255,255,255,.65),0 0 14px rgba(34,211,238,.8);font-variant-numeric:tabular-nums}
.holo-donut-summary{justify-content:center;min-height:260px}.holo-donut-summary .donut{width:190px}.holo-donut-summary .donut::after{inset:29px}.holo-donut-summary .donut b{font-size:1.8rem}
@keyframes crisp-donut-float{50%{transform:translateY(-6px) scale(1.015);filter:brightness(1.08)}}
@media(max-width:560px){.futuristic-stat .donut{width:138px}.holo-donut-summary .donut{width:165px}.holo-donut-summary{min-height:220px}}
@media(prefers-reduced-motion:reduce){.futuristic-stat .donut{animation:none!important}}
.finance-workspace{display:grid;gap:22px}.finance-dashboard,.finance-entry,.finance-ledger,.finance-admin-panel{padding:20px;border:1px solid #273652;border-radius:22px;background:linear-gradient(145deg,rgba(15,25,43,.94),rgba(7,14,27,.96));box-shadow:0 18px 50px rgba(0,0,0,.25)}.finance-kpis{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-bottom:18px}.finance-kpis article{padding:18px;border:1px solid #2a3c5d;border-radius:16px;background:rgba(15,31,53,.8)}.finance-kpis span{display:block;color:#9badc8}.finance-kpis b{font-size:clamp(20px,2vw,30px)}.income{color:#20d7b0!important}.expense{color:#ff6174!important}.finance-chart-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.finance-chart-card{min-width:0;padding:16px;border:1px solid #263856;border-radius:18px;background:radial-gradient(circle at 50% 0,rgba(26,211,245,.12),transparent 48%),#0a1425}.finance-chart-wide{grid-column:span 2}.finance-bar-chart{height:230px;display:flex;align-items:stretch;gap:8px;padding:30px 8px 5px;border-bottom:1px solid #33435d;overflow-x:auto}.finance-bar-group{min-width:48px;flex:1;display:flex;flex-direction:column;justify-content:flex-end;align-items:center}.finance-bar-group>div{width:100%;height:175px;display:flex;align-items:flex-end;justify-content:center;gap:4px;perspective:350px}.finance-bar-group i{display:block;width:min(20px,38%);min-height:2px;border-radius:6px 6px 1px 1px;box-shadow:0 0 16px currentColor;transform:rotateX(4deg);transition:height .55s ease}.finance-bar-group i.income{background:linear-gradient(#63ffe2,#079b82)}.finance-bar-group i.expense{background:linear-gradient(#ff93a0,#c92748)}.finance-bar-group span{font-size:12px;color:#9eabc0;margin-top:6px;white-space:nowrap}.finance-donut-wrap{min-height:230px;display:flex;align-items:center;justify-content:center;gap:24px}.finance-donut{width:180px;aspect-ratio:1;border-radius:50%;display:grid;place-content:center;text-align:center;position:relative;box-shadow:0 0 32px rgba(34,211,238,.25);transform:rotateX(4deg)}.finance-donut:after{content:"";position:absolute;inset:27px;border-radius:50%;background:#0b1526}.finance-donut b,.finance-donut span{position:relative;z-index:1}.finance-donut b{font-size:16px}.finance-donut span{font-size:12px;color:#a8b4c8}.finance-donut-legend{display:grid;gap:12px}.finance-filters{display:grid;grid-template-columns:repeat(7,minmax(120px,1fr));gap:10px;margin-bottom:16px}.finance-table td{vertical-align:top;max-width:360px;white-space:normal;overflow-wrap:anywhere}.finance-type{display:inline-block;padding:5px 10px;border-radius:999px;background:rgba(32,215,176,.12)}.finance-type.expense{background:rgba(255,97,116,.12)}.finance-amount{font-weight:800;white-space:nowrap}.finance-file-list{display:grid;gap:7px}.finance-file-list span{overflow-wrap:anywhere}.finance-file-list a{margin-left:5px}.finance-mobile-list{display:none}.finance-settings{display:flex;flex-wrap:wrap;gap:12px;align-items:end}.finance-settings label{min-width:240px;flex:1}.finance-warnings{margin:18px 0;display:grid;gap:8px}.finance-warnings article{display:flex;gap:12px;justify-content:space-between;padding:12px;border:1px solid rgba(255,97,116,.35);border-radius:12px;background:rgba(255,97,116,.07)}.finance-denied-overlay[hidden]{display:none!important}.finance-denied-overlay{display:grid;place-items:center;position:fixed;inset:0;z-index:10000;background:rgba(1,7,17,.78);backdrop-filter:blur(8px)}.finance-denied-dialog{position:relative;width:min(520px,calc(100vw - 32px));padding:36px 24px;text-align:center;border:1px solid #2f4668;border-radius:22px;background:#101b2e;box-shadow:0 24px 80px #000}.finance-denied-dialog .dialog-close{position:absolute;right:12px;top:10px}.finance-denied-dialog h3{color:#ffb020}
@media(max-width:800px){.finance-workspace{gap:14px}.finance-workspace>.panel-heading{align-items:flex-start}.finance-dashboard,.finance-entry,.finance-ledger,.finance-admin-panel{padding:12px;border-radius:16px}.finance-kpis{grid-template-columns:1fr}.finance-kpis article{padding:13px}.finance-chart-grid{grid-template-columns:1fr}.finance-chart-wide{grid-column:auto}.finance-chart-card{padding:10px}.finance-bar-chart{height:200px}.finance-bar-group{min-width:42px}.finance-donut-wrap{flex-direction:column}.finance-donut{width:min(180px,62vw)}.finance-filters{grid-template-columns:1fr 1fr}.finance-filters #financeSearch{grid-column:span 2}.finance-table{display:none}.finance-mobile-list{display:grid;gap:12px}.finance-mobile-card{min-width:0;padding:15px;border:1px solid #293a57;border-radius:16px;background:#0c1728;overflow:hidden}.finance-mobile-card header{display:flex;align-items:center;justify-content:space-between;gap:10px}.finance-mobile-card header strong{font-size:20px;overflow-wrap:anywhere}.finance-mobile-card h3,.finance-mobile-card p{overflow-wrap:anywhere;word-break:break-word}.finance-mobile-card footer{display:flex;gap:8px;margin-top:12px}.finance-settings{display:grid}.finance-warnings article{display:grid}.finance-ledger .panel-heading{display:grid;gap:10px}}
@media(max-width:430px){.finance-filters{grid-template-columns:1fr}.finance-filters #financeSearch{grid-column:auto}.finance-donut{width:150px}.finance-bar-chart.annual .finance-bar-group{min-width:38px}}
/* Thu Chi: one shared month/year period selector */
.finance-overview-filter{display:flex;flex-wrap:wrap;gap:12px;align-items:end;margin-bottom:18px;padding:14px;border:1px solid #2a3c5d;border-radius:16px;background:rgba(10,20,37,.75)}
.finance-overview-filter label{display:grid;gap:6px;min-width:210px}
.finance-overview-filter select,.finance-overview-filter input{width:100%}
.finance-filters{grid-template-columns:minmax(150px,.75fr) minmax(140px,.65fr) minmax(180px,.8fr) minmax(260px,2fr) minmax(170px,.8fr)}
.finance-ledger-period{display:flex;align-items:center;padding:0 14px;border:1px solid #31415d;border-radius:8px;background:#0c1627;color:#27d3f2;font-weight:700}
@media(max-width:800px){.finance-overview-filter{display:grid;grid-template-columns:1fr 1fr}.finance-overview-filter label{min-width:0}.finance-filters{grid-template-columns:1fr 1fr}}
@media(max-width:430px){.finance-overview-filter,.finance-filters{grid-template-columns:1fr}}
.date-picker-field{position:relative;display:block}.date-picker-field input{width:100%;padding-right:50px}.date-picker-field button{position:absolute;right:4px;top:50%;transform:translateY(-50%);width:40px;height:36px;padding:0;border:0;border-left:1px solid #33435d;background:transparent;cursor:pointer;font-size:18px;line-height:1}.date-picker-field button:hover,.date-picker-field button:focus-visible{background:rgba(34,211,238,.12);outline:1px solid #22d3ee;border-radius:6px}
/* Mobile navigation scales through a five-item bar and an expandable function sheet. */
.mobile-more-btn,.mobile-more-overlay{display:none}
@media(max-width:800px){
  .date-picker-field{width:100%;min-width:0;max-width:100%;overflow:hidden}
  .date-picker-field input{display:block;min-width:0;max-width:100%;width:100%!important;box-sizing:border-box;padding-right:50px!important}
  .date-picker-field input::-webkit-calendar-picker-indicator{opacity:0;width:0;padding:0;margin:0;pointer-events:none}
  .date-picker-field button{display:grid;place-items:center;right:3px;width:43px;height:calc(100% - 6px);max-height:42px;color:inherit;background:#142238;border:1px solid #375070;border-radius:8px;z-index:2}
  .form-grid>label,.correspondence-date-field{min-width:0;max-width:100%}
  .mobile-bottom-nav{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;overflow:visible!important;padding-bottom:max(6px,env(safe-area-inset-bottom))!important}
  .mobile-bottom-nav>.mobile-nav-btn,.mobile-more-btn{display:flex!important;min-width:0!important;width:100%!important;flex:none!important;align-items:center;justify-content:center;flex-direction:column;gap:3px;padding:5px 2px!important;border:0;background:transparent;color:#9aa8bd;font:inherit}
  .mobile-bottom-nav>.mobile-nav-btn svg,.mobile-more-btn svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8}
  .mobile-bottom-nav>.mobile-nav-btn span,.mobile-more-btn span{display:block;max-width:100%;font-size:11px;line-height:1.15;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .mobile-more-btn.active{color:#ff9f0a}
  .mobile-more-overlay{display:block;position:fixed;inset:0;z-index:9998;background:rgba(1,6,16,.72);backdrop-filter:blur(5px);opacity:0;transition:opacity .2s ease}
  .mobile-more-overlay[hidden]{display:none!important}
  .mobile-more-overlay.active{opacity:1}
  .mobile-more-sheet{position:absolute;left:10px;right:10px;bottom:calc(72px + env(safe-area-inset-bottom));max-height:min(70vh,560px);overflow:auto;padding:16px;border:1px solid #314667;border-radius:22px;background:linear-gradient(160deg,#111d31,#081222);box-shadow:0 -18px 60px rgba(0,0,0,.55);transform:translateY(24px);transition:transform .2s ease}
  .mobile-more-overlay.active .mobile-more-sheet{transform:translateY(0)}
  .mobile-more-sheet header{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px}
  .mobile-more-sheet header small{color:#46cdf3;font-weight:800;letter-spacing:.12em}.mobile-more-sheet header h2{margin:2px 0 0;font-size:20px}
  .mobile-more-sheet header button{width:40px;height:40px;border:1px solid #405473;border-radius:12px;background:#16243a;color:#fff;font-size:26px}
  .mobile-more-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
  .mobile-more-grid .mobile-nav-btn{display:flex!important;min-width:0;min-height:96px;padding:12px 6px!important;align-items:center;justify-content:center;flex-direction:column;gap:8px;border:1px solid #2b3c59;border-radius:16px;background:#0d192b;color:#b6c2d5;text-align:center}
  .mobile-more-grid .mobile-nav-btn[hidden]{display:none!important}
  .mobile-more-grid .mobile-nav-btn.active{border-color:#10bce9;background:rgba(14,165,233,.14);color:#ffab19}
  .mobile-more-grid .mobile-nav-btn svg{width:28px;height:28px;fill:none;stroke:currentColor;stroke-width:1.8}
  .mobile-more-grid .mobile-nav-btn span{font-size:13px;line-height:1.25;overflow-wrap:anywhere}
  body.mobile-sheet-open{overflow:hidden}
}
@media(max-width:390px){.mobile-more-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.mobile-bottom-nav>.mobile-nav-btn span,.mobile-more-btn span{font-size:10px}}
@media(min-width:801px){
  .correspondence-table th:first-child,.correspondence-table td:first-child{min-width:74px}
  .correspondence-table th:last-child,.correspondence-table td:last-child{min-width:92px}
  .correspondence-table .mail-badge{min-width:54px;white-space:nowrap;text-align:center}
  .correspondence-table .mail-row-actions{display:flex;min-width:76px;justify-content:center}
  .correspondence-table .mail-row-actions .btn-secondary{display:inline-flex;align-items:center;justify-content:center;min-width:76px;white-space:nowrap;padding-left:14px;padding-right:14px}
}

.work-schedule-workspace{display:grid;gap:18px}.work-schedule-filters{display:grid;grid-template-columns:repeat(3,minmax(220px,1fr));gap:12px}.work-schedule-filters label,.work-schedule-form label{display:grid;gap:7px;color:#dbeafe;font-weight:700}.work-schedule-filters select,.work-schedule-filters input,.work-schedule-form input,.work-schedule-form textarea{width:100%;min-width:0;border:1px solid rgba(96,165,250,.3);border-radius:11px;background:#081322;color:#fff}.work-schedule-filters select,.work-schedule-filters input{min-height:48px;padding:10px 12px;font-size:1rem}.work-schedule-entry,.work-schedule-board{padding:18px;border:1px solid rgba(56,189,248,.2);border-radius:17px;background:linear-gradient(150deg,rgba(12,23,42,.95),rgba(5,13,27,.96));box-shadow:0 14px 35px rgba(0,0,0,.18)}.work-schedule-entry h3{margin:0 0 14px;color:#f8fafc}.work-schedule-form input,.work-schedule-form textarea{padding:14px 15px;font-size:clamp(1.25rem,1.35vw,1.55rem);line-height:1.5}.work-schedule-form textarea{resize:vertical}.work-schedule-form input::placeholder,.work-schedule-form textarea::placeholder{color:#8391a7}.work-schedule-range-heading,.work-schedule-day-detail>header{display:flex;align-items:center;justify-content:space-between;gap:12px}.work-schedule-range-heading h3,.work-schedule-day-detail h3{margin:0}.work-schedule-range-heading p{margin:4px 0 0;color:#9fb0c7}.work-schedule-range-heading>span,.work-schedule-day-detail>header>span{padding:7px 11px;border-radius:999px;background:rgba(14,165,233,.14);color:#67e8f9;font-weight:800;white-space:nowrap}.work-schedule-day-strip{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(92px,1fr);gap:9px;margin:16px 0;overflow-x:auto;padding:3px 2px 10px;scrollbar-width:thin}.work-schedule-day{display:grid;justify-items:center;gap:2px;min-height:112px;padding:10px 7px;border:1px solid rgba(148,163,184,.2);border-radius:13px;background:#0b1627;color:#aebbd0;cursor:pointer}.work-schedule-day span{text-transform:capitalize}.work-schedule-day b{font-size:1.7rem;color:#f8fafc}.work-schedule-day small{color:#91a2ba}.work-schedule-day em{font-style:normal;font-size:.75rem;color:#8290a5}.work-schedule-day.has-work em{color:#fbbf24;font-weight:800}.work-schedule-day.active{border-color:#38bdf8;background:linear-gradient(155deg,rgba(2,132,199,.3),rgba(30,64,175,.2));box-shadow:0 0 0 2px rgba(56,189,248,.12),0 12px 25px rgba(2,132,199,.16)}.work-schedule-day-detail{display:grid;gap:12px}.work-schedule-day-detail>header{padding-bottom:12px;border-bottom:1px solid rgba(148,163,184,.16)}.work-schedule-day-detail>header small{text-transform:capitalize;color:#7dd3fc;font-weight:800}.work-schedule-card{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:15px;padding:15px;border:1px solid rgba(148,163,184,.18);border-radius:14px;background:rgba(8,18,34,.88)}.work-schedule-card dl{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:0}.work-schedule-card dl>div{min-width:0;padding:10px;border-radius:10px;background:rgba(15,30,51,.72)}.work-schedule-card dt{margin-bottom:5px;color:#7dd3fc;font-size:.78rem;font-weight:800;text-transform:uppercase}.work-schedule-card dd{margin:0;color:#f8fafc;font-size:1rem;line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere}.work-schedule-actions{display:flex;align-items:center;gap:7px}
.work-schedule-overview{padding:18px;border:1px solid rgba(56,189,248,.2);border-radius:17px;background:linear-gradient(150deg,rgba(12,23,42,.95),rgba(5,13,27,.96));box-shadow:0 14px 35px rgba(0,0,0,.18)}.work-schedule-overview-heading{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:14px}.work-schedule-overview-heading h3{margin:0;color:#f8fafc}.work-schedule-overview-heading p{margin:5px 0 0;color:#9fb0c7}.work-schedule-overview-table-wrap{width:100%;overflow-x:auto;border:1px solid rgba(148,163,184,.18);border-radius:14px}.work-schedule-overview-table{width:100%;min-width:940px;border-collapse:collapse;table-layout:fixed;background:rgba(5,14,27,.7)}.work-schedule-overview-table th,.work-schedule-overview-table td{padding:13px 14px;border-bottom:1px solid rgba(148,163,184,.16);vertical-align:top;text-align:left;overflow-wrap:anywhere}.work-schedule-overview-table th{background:rgba(15,31,53,.95);color:#fbbf24;font-size:.92rem}.work-schedule-overview-table tr:last-child td{border-bottom:0}.work-schedule-overview-table th:nth-child(1){width:18%}.work-schedule-overview-table th:nth-child(2){width:34%}.work-schedule-overview-table th:nth-child(3){width:17%}.work-schedule-overview-table th:nth-child(4){width:21%}.work-schedule-overview-table th:nth-child(5){width:10%}.work-schedule-overview-table td{color:#eef6ff;line-height:1.55}.work-schedule-overview-text{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:3;white-space:pre-wrap}.work-schedule-overview-text.expanded{display:block;overflow:visible}.work-schedule-expand-btn{margin-top:6px;padding:0;border:0;background:transparent;color:#38bdf8;font:inherit;font-size:.86rem;font-weight:800;cursor:pointer}.work-schedule-overview-table .work-schedule-actions{align-items:stretch;flex-direction:column}.work-schedule-overview-table .work-schedule-actions button{width:100%;white-space:nowrap}.work-schedule-overview-mobile{display:none}
.work-assignee-picker{position:relative;display:grid;gap:9px;min-width:0}.work-assignee-selected{display:flex;align-items:center;flex-wrap:wrap;gap:8px;min-height:48px;padding:9px;border:1px solid rgba(96,165,250,.22);border-radius:11px;background:rgba(5,15,29,.62)}.work-assignee-placeholder{color:#8391a7;font-weight:500}.work-assignee-chip{display:inline-flex;align-items:center;gap:7px;max-width:100%;padding:7px 8px 7px 12px;border:1px solid rgba(56,189,248,.45);border-radius:999px;background:rgba(14,165,233,.16);color:#e0f2fe;font-size:1rem;line-height:1.3;overflow-wrap:anywhere}.work-assignee-chip button{display:inline-grid;place-items:center;width:28px;height:28px;min-width:28px;padding:0;border:0;border-radius:50%;background:rgba(239,68,68,.2);color:#fecaca;font-size:1.25rem;line-height:1;cursor:pointer}.work-assignee-chip button:hover{background:#dc2626;color:#fff}.work-assignee-dropdown{position:absolute;z-index:80;top:calc(100% + 6px);left:0;right:0;max-height:300px;overflow-y:auto;padding:7px;border:1px solid rgba(56,189,248,.38);border-radius:12px;background:#071426;box-shadow:0 18px 40px rgba(0,0,0,.48)}.work-assignee-dropdown button{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:11px 12px;border:0;border-radius:9px;background:transparent;color:#f8fafc;text-align:left;cursor:pointer}.work-assignee-dropdown button:hover,.work-assignee-dropdown button:focus{background:rgba(14,165,233,.18);outline:none}.work-assignee-dropdown button span{font-size:1.05rem;font-weight:800;overflow-wrap:anywhere}.work-assignee-dropdown button small{color:#8ea2bd;white-space:nowrap}.work-assignee-dropdown .empty-state{margin:0;padding:12px}

/* Account avatars and internal chat identity */
.chat-user-avatar{width:54px!important;height:54px!important;flex:0 0 54px!important;overflow:hidden}
.chat-user-avatar img,.internal-message-avatar img{width:100%;height:100%;display:block;object-fit:cover;border-radius:50%}
.internal-chat-message{display:flex!important;flex-direction:row!important;align-items:flex-start!important;gap:9px}
.internal-chat-message.mine{flex-direction:row-reverse!important;align-self:flex-end!important}
.internal-message-avatar{width:42px;height:42px;flex:0 0 42px;display:grid;place-items:center;overflow:hidden;border-radius:50%;background:linear-gradient(135deg,#0369a1,#38bdf8);color:#fff;font-size:.85em;font-weight:800;box-shadow:0 0 0 2px rgba(56,189,248,.2)}
.internal-message-content{display:flex;flex-direction:column;align-items:flex-start;min-width:0;max-width:100%}
.internal-chat-message.mine .internal-message-content{align-items:flex-end}
.internal-message-meta b{color:#e2e8f0}
.avatar-editor[hidden]{display:none}
.avatar-editor{border:1px solid rgba(56,189,248,.28);border-radius:12px;padding:1rem;background:rgba(8,15,28,.55)}
.avatar-editor legend{padding:0 .45rem;color:var(--primary-gold);font-weight:700}
.avatar-editor-layout{display:grid;grid-template-columns:220px minmax(0,1fr);align-items:center;gap:1.25rem}
.avatar-crop-stage{position:relative;width:200px;height:200px;margin:auto;border-radius:50%;overflow:hidden;border:3px solid #38bdf8;background:#0b1220;box-shadow:0 0 0 7px rgba(56,189,248,.1),0 14px 34px rgba(0,0,0,.36);touch-action:none;user-select:none}
.avatar-crop-stage canvas{display:block;width:100%;height:100%;cursor:grab}
.avatar-crop-stage canvas.dragging{cursor:grabbing}
.avatar-crop-hint{position:absolute;inset:0;display:grid;place-items:center;color:var(--text-muted);pointer-events:none}
.avatar-editor-controls{display:grid;gap:.8rem;min-width:0}
.avatar-editor-controls>label{display:grid;gap:.4rem;color:#e2e8f0}
.avatar-editor-controls input[type="range"]{width:100%;accent-color:#0ea5e9}
.avatar-editor-controls p{margin:0;color:var(--text-muted);line-height:1.5}
.avatar-editor-actions{display:flex;flex-wrap:wrap;gap:.65rem}
@media (max-width:620px){.avatar-editor-layout{grid-template-columns:1fr}.avatar-crop-stage{width:180px;height:180px}.chat-user-avatar{width:54px!important;height:54px!important;flex-basis:54px!important}.internal-message-avatar{width:38px;height:38px;flex-basis:38px}.internal-chat-message{max-width:98%!important}}
#workScheduleView > .work-schedule-workspace > .panel-heading p{display:none}
.session-viewer-card{width:min(820px,100%)}.session-device-list{display:grid;gap:.75rem}.session-device-item{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:1rem;align-items:center;padding:1rem;border:1px solid rgba(96,165,250,.22);border-radius:13px;background:rgba(8,18,34,.82)}.session-device-item h3{margin:0 0 .35rem;color:#f8fafc;font-size:1.05rem}.session-device-item p{margin:.22rem 0;color:#cbd5e1;line-height:1.45}.session-device-item code{color:#7dd3fc}.session-current-badge{display:inline-flex;margin-left:.45rem;padding:.2rem .48rem;border-radius:999px;background:rgba(16,185,129,.16);color:#6ee7b7;font-size:.75rem}.view-user-sessions{white-space:nowrap}.security-device-info{color:#fbbf24!important;font-weight:700}.security-device-info span{color:#cbd5e1;font-weight:500}@media(max-width:720px){.session-device-item{grid-template-columns:1fr}.session-device-item>button{width:100%}}

/* Hồ Sơ Vụ Việc mở rộng */
.matter-card-progress,.matter-progress{height:9px;overflow:hidden;border-radius:999px;background:#172235;border:1px solid #2b3b55}.matter-card-progress i,.matter-progress i{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,#13b9ff,#21d4a7,#ff9d00);transition:width .35s ease}.matter-progress-head{display:flex;justify-content:space-between;gap:16px;margin:18px 0 8px;color:#bdd0e8}.matter-suite-overview .matter-actions{display:flex;flex-wrap:wrap;justify-content:flex-end}.matter-warnings{display:grid;gap:8px;margin-top:18px}.matter-warnings span{padding:10px 13px;border:1px solid #334155;border-radius:10px;background:#101a2b}.matter-warnings .danger{border-color:#ef4444;color:#fecaca}.matter-warnings .warning{border-color:#f59e0b;color:#fde68a}.matter-warnings .ok{border-color:#10b981;color:#a7f3d0}.matter-suite-section{margin:18px 0;border:1px solid #26364e;border-radius:16px;background:#0b1424;overflow:hidden}.matter-suite-section>summary{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:18px 20px;cursor:pointer;list-style:none;background:linear-gradient(120deg,#111d31,#0d1727)}.matter-suite-section>summary::-webkit-details-marker{display:none}.matter-suite-section>summary span{display:grid;gap:5px}.matter-suite-section>summary b{font-size:1.12rem;color:#fff}.matter-suite-section>summary small{color:#9db0ca;line-height:1.5}.matter-suite-section>summary i{font-style:normal;color:#43c7ff;font-size:1.4rem;transition:transform .2s}.matter-suite-section[open]>summary i{transform:rotate(180deg)}.matter-suite-body{padding:16px}.matter-edit-row{display:grid;gap:10px;padding:15px;margin-bottom:12px;border:1px solid #26364e;border-radius:13px;background:#0f192a}.matter-edit-row input,.matter-edit-row select,.matter-edit-row textarea,.matter-quick-add input,.matter-quick-add select,.matter-quick-add textarea,.matter-fee-form input{width:100%;min-width:0;color:#fff;background:#0a1322;border:1px solid #32445f;border-radius:9px;padding:11px 12px}.matter-edit-row textarea,.matter-quick-add textarea{resize:vertical}.matter-inline-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px}.matter-inline-grid label{display:grid;gap:5px;color:#b8c7dc}.matter-row-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:9px}.matter-row-actions button{min-width:78px}.matter-synced{margin-right:auto;color:#6ee7b7;font-weight:700}.matter-quick-add{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;align-items:end;margin-top:16px;padding:15px;border:1px dashed #2877a6;border-radius:13px;background:#0a1829}.matter-quick-add h4{grid-column:1/-1;margin:0;color:#58d0ff}.matter-quick-add textarea{min-height:82px}.matter-fee-form{display:flex;align-items:end;gap:10px;padding:14px;margin-top:15px;border:1px solid #334155;border-radius:12px}.matter-fee-form label{display:grid;gap:6px;flex:1;color:#c9d8eb}.matter-form-extended fieldset{border:1px solid #30415d;border-radius:12px;padding:14px}.matter-form-extended legend{padding:0 8px;color:#53ccff;font-weight:800}.matter-choice-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:8px;margin-bottom:13px}.matter-choice-grid label{display:flex;align-items:center;gap:8px;padding:10px;border:1px solid #293a54;border-radius:9px;background:#0c1728}.matter-choice-grid input{width:auto}.matter-access-box>label,.matter-assignee-box>label{display:grid;gap:7px;margin-top:10px}.matter-suite-body .timeline-list{margin-top:15px}
@media(max-width:760px){.matter-suite-overview .panel-heading{align-items:flex-start}.matter-suite-overview .matter-actions{width:100%;justify-content:flex-start}.matter-suite-overview .matter-actions>*{flex:1 1 calc(50% - 8px);text-align:center;white-space:normal}.matter-progress-head{display:grid;gap:4px}.matter-suite-section>summary{padding:15px}.matter-suite-section>summary small{font-size:.84rem}.matter-suite-body{padding:11px}.matter-edit-row{padding:11px}.matter-inline-grid{grid-template-columns:1fr}.matter-quick-add{grid-template-columns:1fr}.matter-choice-grid{grid-template-columns:1fr}.matter-fee-form{display:grid}.matter-row-actions{justify-content:stretch}.matter-row-actions button{flex:1}.matter-row-actions .matter-synced{width:100%}.matter-link-grid{grid-template-columns:1fr}.matter-form-extended fieldset{padding:11px}.matter-edit-row input,.matter-edit-row select,.matter-edit-row textarea,.matter-quick-add input,.matter-quick-add select,.matter-quick-add textarea{font-size:16px}.matter-suite-section .legal-review{grid-template-columns:1fr;overflow-wrap:anywhere}}
.matter-private-files{display:grid;gap:14px}.matter-file-toolbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.matter-file-toolbar small{color:#9fb0c9}.matter-private-file-list{display:grid;gap:10px}.matter-private-file-list article{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px;border:1px solid #27344a;border-radius:12px;background:#0d1627}.matter-private-file-list article>div:first-child{min-width:0;display:grid;gap:5px}.matter-private-file-list b,.matter-private-file-list small{overflow-wrap:anywhere}.matter-private-file-list small{color:#9fb0c9}.matter-access-admin{display:grid;gap:18px}.matter-access-controls{display:grid;grid-template-columns:minmax(260px,1fr) minmax(300px,1fr);gap:14px;align-items:end}.matter-access-controls label{display:grid;gap:8px}.matter-access-all{display:flex!important;align-items:center;min-height:48px;padding:12px 14px;border:1px solid #2a3952;border-radius:12px;background:#0d1627}.matter-access-all input{width:20px;height:20px}.matter-access-toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:center}.matter-access-toolbar span{color:#67d7ff;white-space:nowrap}.matter-access-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;max-height:560px;overflow:auto;padding-right:5px}.matter-access-list>label{display:flex;align-items:flex-start;gap:12px;padding:14px;border:1px solid #27344a;border-radius:12px;background:#0d1627}.matter-access-list input{flex:0 0 auto;width:20px;height:20px;margin-top:2px}.matter-access-list span{min-width:0;display:grid;gap:5px}.matter-access-list b,.matter-access-list small{overflow-wrap:anywhere}.matter-access-list small{color:#9fb0c9}
@media(max-width:760px){.matter-private-file-list article{align-items:stretch;flex-direction:column}.matter-private-file-list .matter-row-actions{display:grid;grid-template-columns:repeat(3,1fr)}.matter-private-file-list .matter-row-actions>*{text-align:center}.matter-access-controls,.matter-access-list{grid-template-columns:1fr}.matter-access-toolbar{grid-template-columns:1fr}.matter-access-list{max-height:none}}
