:root {
  --blue-950: #0f172a;
  --blue-900: #1e293b;
  --blue-800: #0f3d6d;
  --blue-700: #1d4ed8;
  --red-700: #dc2626;
  --red-600: #ef4444;
  --bg: #f8fafc;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --soft-blue: #f1f5f9;
  --danger: #ef4444;
  --warning: #f59e0b;
  --ok: #10b981;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-soft: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  --radius-sm: 6px;
  --radius-md: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  min-height: 38px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

button:hover {
  border-color: var(--blue-700);
  color: var(--blue-900);
}

.app-shell {
  min-height: 100vh;
}

.corporate-header {
  height: 60px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.corporate-brand,
.header-actions,
.brand {
  display: flex;
  align-items: center;
}

.corporate-brand {
  gap: 14px;
}

.logo-mark {
  width: 76px;
  height: 38px;
  background: var(--blue-800);
  color: #fff;
  display: grid;
  place-items: center;
  line-height: 1;
  letter-spacing: 0;
  border-radius: var(--radius-sm);
}

.logo-mark span {
  font-size: 12px;
  font-weight: 800;
}

.logo-mark strong {
  font-size: 20px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.corporate-brand h1 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
}

.header-actions {
  gap: 14px;
}

.system-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
  border-radius: var(--radius-sm);
}

#app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 60px);
}

.sidebar {
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-right: 1px solid #1e293b;
}

.brand {
  gap: 12px;
}

.mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: #0f3d6d;
  color: #fff;
  font-weight: 800;
  box-shadow: none;
  border-radius: var(--radius-sm);
}

.brand h2 {
  margin: 0;
  font-size: 17px;
}

.brand p,
.policy-note span {
  margin: 3px 0 0;
  color: rgba(238, 246, 255, 0.74);
  font-size: 13px;
  line-height: 1.45;
}

.field {
  display: grid;
  gap: 8px;
  color: rgba(238, 246, 255, 0.86);
  font-size: 13px;
  font-weight: 700;
}

.field select,
.toolbar input,
.chat-form input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  min-height: 42px;
  padding: 0 13px;
  color: var(--ink);
  outline: none;
  border-radius: var(--radius-sm);
}

.field select {
  border-color: rgba(255, 255, 255, 0.24);
}

.toolbar input:focus,
.chat-form input:focus,
.field select:focus {
  border-color: var(--blue-700);
  box-shadow: 0 0 0 3px rgba(15, 99, 183, 0.12);
}

.nav {
  display: grid;
  gap: 8px;
}

#driveNav[hidden], #onedriveNav[hidden] {
  display: none;
}


.nav-button {
  width: 100%;
  text-align: left;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #eef6ff;
  position: relative;
  border-radius: var(--radius-sm);
}

.nav-button span {
  position: relative;
  z-index: 1;
}

.nav-button::before {
  content: "";
  width: 4px;
  height: calc(100% - 12px);
  background: transparent;
  position: absolute;
  left: 0;
  top: 6px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.nav-button:hover,
.nav-button.active {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-button.active::before {
  background: #38bdf8;
}

.policy-note {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid #38bdf8;
  padding: 12px 14px;
  display: grid;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
}

.policy-note strong {
  font-size: 13px;
  text-transform: uppercase;
}

.main {
  padding: 24px 28px 30px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.topbar h2 {
  margin: 0;
  color: var(--blue-950);
  font-size: 28px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.user-badge {
  border: 1px solid var(--line);
  background: #f8fbff;
  padding: 9px 12px;
  min-width: 236px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  border-radius: var(--radius-md);
}

.user-badge strong {
  color: var(--blue-950);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.summary-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue-700);
  padding: 15px 16px;
  box-shadow: var(--shadow-soft);
  border-radius: var(--radius-md);
}

.summary-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  margin-top: 5px;
  color: var(--blue-950);
  font-size: 28px;
}

.summary-card.accent {
  border-top-color: var(--red-700);
}

.summary-card.accent strong {
  font-size: 20px;
  line-height: 1.25;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.toolbar input {
  max-width: 540px;
}

.toolbar button,
.chat-form button[type="submit"],
.workflow-actions button:first-child {
  background: var(--red-700);
  border-color: var(--red-700);
  color: #fff;
}

.toolbar button:hover,
.chat-form button[type="submit"]:hover,
.document-form button[type="submit"]:hover,
.workflow-actions button:first-child:hover {
  background: #bd151b;
  border-color: #bd151b;
  color: #fff;
}

.document-form {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue-700);
  background: var(--panel);
  border-radius: var(--radius-md);
}

.document-form[hidden] {
  display: none;
}

.form-heading,
.document-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-heading {
  margin-bottom: 14px;
}

.form-heading h3,
.form-heading p {
  margin: 0;
}

.form-heading p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.document-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.document-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--blue-950);
  font-size: 12px;
  font-weight: 800;
}

.document-form-grid .wide {
  grid-column: 1 / -1;
}

.document-form-grid input,
.document-form-grid select,
.document-form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border-radius: var(--radius-sm);
}

.document-form-grid textarea {
  min-height: 76px;
  resize: vertical;
}

.document-form-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

.checkbox-field {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.tag-row span {
  padding: 3px 7px;
  border: 1px solid rgba(15, 99, 183, 0.2);
  background: #eef5ff;
  color: var(--blue-900);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
}

.draft-section {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 14px;
  border-radius: var(--radius-md);
}

.draft-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.draft-item {
  border: 1px solid var(--line);
  padding: 12px;
  background: #f8fbff;
  border-radius: var(--radius-sm);
}

.draft-heading,
.attachment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.matched-attachment {
  border: 2px solid var(--red-700);
  padding: 8px;
  background: #fff2f2;
  border-radius: var(--radius-sm);
}

.draft-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.draft-meta-grid div {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 9px 10px;
  min-width: 0;
}

.draft-meta-grid span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.draft-meta-grid strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.attachment-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.attachment-row {
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.attachment-row small {
  color: var(--muted);
}

.attachment-review {
  display: grid;
  gap: 4px;
  margin-top: 7px;
  font-size: 11px;
  font-weight: 800;
}

.attachment-review input,
.attachment-review textarea {
  width: 100%;
  border: 1px solid var(--line);
  padding: 7px 9px;
  background: #fff;
  border-radius: var(--radius-sm);
}

.attachment-review textarea {
  min-height: 56px;
  resize: vertical;
}

.draft-warning {
  margin-top: 10px;
  border-left: 3px solid var(--red-700);
  padding: 8px 10px;
  background: #fff2f2;
  color: #8e1117;
  font-size: 12px;
  font-weight: 700;
}

.result-menu {
  margin-top: 8px;
  font-size: 12px;
}

.result-menu a {
  display: block;
  margin-top: 5px;
}

.secondary-action {
  background: #eef5ff;
  border-color: rgba(15, 99, 183, 0.24);
  color: var(--blue-900);
}

.secondary-action:hover {
  background: #dfeeff;
  border-color: var(--blue-700);
  color: var(--blue-950);
}

.danger-action {
  background: #fff2f2;
  border-color: rgba(189, 21, 27, 0.35);
  color: var(--red-700);
}

.danger-action:hover {
  background: var(--red-700);
  border-color: var(--red-700);
  color: #fff;
}

.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.panel,
.detail,
.chat-layout,
.chat-sidebar {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius-md);
}

.panel {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  text-align: left;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: top;
}

th {
  background: var(--soft-blue);
  color: var(--blue-950);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  position: sticky;
  top: 0;
}

tr {
  cursor: pointer;
}

tr:hover td {
  background: #f8fbff;
}

td strong {
  color: var(--blue-950);
}

.detail {
  padding: 20px;
  min-height: 390px;
  line-height: 1.6;
  border-top: 4px solid var(--blue-700);
}

.detail h3 {
  margin: 0 0 8px;
  color: var(--blue-950);
  font-size: 21px;
}

.detail h4 {
  color: var(--blue-950);
  margin-bottom: 8px;
}

.detail ul {
  padding-left: 20px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 1px 8px;
  border: 1px solid var(--line);
  background: #f8fbff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
  border-radius: 4px;
}

.pill.ok {
  color: var(--ok);
  border-color: rgba(4, 120, 87, 0.2);
  background: rgba(4, 120, 87, 0.06);
}

.pill.warn {
  color: var(--warning);
  border-color: rgba(181, 71, 8, 0.2);
  background: rgba(181, 71, 8, 0.06);
}

.pill.danger {
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.2);
  background: rgba(180, 35, 24, 0.06);
}

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

.workflow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.chat-workspace {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  transition: grid-template-columns 0.3s ease;
}

.chat-workspace.sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.chat-workspace.sidebar-collapsed .chat-sidebar {
  display: none !important;
}

.chat-layout {
  height: calc(100vh - 238px);
  min-height: calc(100vh - 238px);
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 1fr auto;
  border-top: 4px solid var(--blue-700);
  overflow: hidden;
}

.chat-sidebar {
  min-height: calc(100vh - 238px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  overflow: hidden;
}

.chat-side-section {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.chat-side-section + .chat-side-section {
  border-top: 1px solid var(--line);
}

.side-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 15px 10px;
  background: #f8fbff;
}

.side-heading span {
  color: var(--blue-950);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.side-heading strong {
  min-width: 28px;
  min-height: 28px;
  display: grid;
  place-items: center;
  background: var(--blue-900);
  color: #fff;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.doc-list {
  min-height: 0;
  overflow: auto;
  padding: 10px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.doc-item {
  border: 1px solid var(--line);
  background: #fff;
  padding: 11px 12px;
  border-radius: var(--radius-md);
}

.doc-item.suggested {
  background: #fffdf7;
  border-color: rgba(181, 71, 8, 0.22);
}

.doc-item-title {
  display: block;
  color: var(--blue-950);
  font-weight: 800;
  line-height: 1.35;
  text-decoration: none;
}

.doc-item-title[href]:hover {
  color: var(--red-700);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.doc-item-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.doc-empty {
  border: 1px dashed var(--line);
  color: var(--muted);
  padding: 12px;
  font-size: 13px;
  line-height: 1.45;
  border-radius: var(--radius-md);
}

/* Dept view styles */
.dept-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dept-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}

.dept-icon-large {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #0f3d6d;
  color: #fff;
  flex-shrink: 0;
}

.dept-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 3px;
}

.dept-header p {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}

/* Department Functions Catalog */
.dept-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  margin-bottom: -4px;
}

.dept-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dept-functions-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dept-func-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.dept-func-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.dept-func-card:focus-visible {
  outline: 2px solid var(--blue-700);
  outline-offset: 2px;
}

.dept-func-left {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.dept-func-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  background: #f1f5f9;
  color: var(--blue-800);
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.dept-func-card:hover .dept-func-icon {
  background: #0f3d6d;
  color: #ffffff;
}

.dept-func-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.dept-func-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dept-func-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.dept-func-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.dept-func-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 3px;
}

.dept-func-tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 500;
  color: #475569;
}

.dept-func-action {
  flex-shrink: 0;
}

.dept-func-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  min-height: 36px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
}

.dept-func-btn:hover,
.dept-func-card:hover .dept-func-btn {
  background: #0f3d6d;
  color: #ffffff;
  border-color: #0f3d6d;
}

/* Modals for Department Functions */
.dept-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.dept-modal-dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: min(900px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

.dept-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background: var(--panel);
}

.dept-modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.dept-modal-desc {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

.dept-modal-close {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.dept-modal-close:hover {
  background: var(--surface-hover, #f1f5f9);
  color: var(--ink);
  border-color: #cbd5e1;
}

.dept-modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dept-modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface);
}

.dept-coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 24px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
  background: var(--surface);
}

.dept-coming-icon {
  font-size: 32px;
  line-height: 1;
}

.dept-coming-soon strong {
  font-size: 15px;
  color: var(--text);
}

.dept-coming-soon p {
  font-size: 13px;
  color: var(--muted);
  max-width: 48ch;
  line-height: 1.55;
  margin: 0;
}

.chat-messages {
  min-height: 0;
  padding: 20px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 82ch;
  padding: 13px 15px;
  border: 1px solid var(--line);
  background: #f8fbff;
  white-space: pre-wrap;
  line-height: 1.55;
  border-radius: var(--radius-md);
}

.message.user {
  align-self: flex-end;
  background: var(--blue-900);
  border-color: var(--blue-900);
  color: #fff;
}

.message a {
  color: var(--blue-800);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.download-links {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.download-links-title {
  color: var(--red-700);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.download-links ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.message-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.message-actions .secondary-action {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.search-note {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: #5d6675;
  font-size: 12px;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr 84px;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 14px;
  background: #f8fbff;
}

@media (max-width: 1120px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .split {
    grid-template-columns: 1fr;
  }

  .document-form-grid {
    grid-template-columns: 1fr;
  }

  .document-form-grid .wide {
    grid-column: auto;
  }

  .chat-workspace {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    min-height: 420px;
  }
}

@media (max-width: 760px) {
  .corporate-header {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .header-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  #app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .main {
    padding: 18px 14px 24px;
  }

  .topbar {
    display: grid;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .chat-form {
    grid-template-columns: 1fr;
    display: grid;
  }
}

/* PVTrans-PTT Enterprise Minimalist Workspace */
:root {
  --blue-950: #0f172a;
  --blue-900: #1e293b;
  --blue-800: #0f3d6d;
  --blue-700: #1d4ed8;
  --red-700: #dc2626;
  --red-600: #ef4444;
  --bg: #f1f6fb;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --soft-blue: #eff7f9;
  --danger: #ef4444;
  --warning: #f59e0b;
  --ok: #10b981;
  --mint: #f1f5f9;
  --mint-strong: #cbd5e1;
  --forest: #263f50;
  --charcoal: #1e293b;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-soft: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

body {
  background: var(--bg);
}

button {
  border-color: var(--line);
  min-height: 38px;
}

button:hover {
  border-color: var(--blue-700);
  color: var(--blue-900);
  transform: translateY(-1px);
}

.corporate-header {
  height: 60px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

.corporate-logo {
  width: 110px;
  height: 40px;
  object-fit: contain;
  object-position: left center;
  border-right: 1px solid var(--line);
  padding-right: 14px;
}

.eyebrow {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
  font-weight: 700;
  text-transform: uppercase;
}

.corporate-brand h1 {
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.system-status {
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  text-transform: none;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
}

.system-status i,
.topbar-context::before,
.assistant-banner i b {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.user-badge {
  min-width: 220px;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

#app {
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: calc(100vh - 60px);
}

.sidebar {
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  padding: 16px 12px;
  background: #0f172a;
  border-right: 1px solid #1e293b;
  gap: 16px;
  overflow-y: auto;
}

.brand {
  gap: 10px;
  padding: 0 4px;
}

.mark {
  width: 36px;
  height: 36px;
  background: #1e293b;
  color: #38bdf8;
  box-shadow: none;
  border-radius: 6px;
  font-weight: 800;
}

.brand-label {
  display: block;
  color: #38bdf8;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.brand h2 {
  margin-top: 1px;
  font-size: 16px;
  color: #f8fafc;
}

.brand p {
  margin-top: 1px;
  font-size: 11px;
}

.field {
  padding: 13px;
  gap: 7px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  font-size: 11px;
  text-transform: uppercase;
}

.field select {
  min-height: 38px;
  border-color: rgba(255, 255, 255, 0.12);
  font-size: 12px;
}

.nav {
  gap: 5px;
}

.nav-label {
  margin: 0 8px 5px;
  color: rgba(238, 247, 242, 0.48);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

/* Section separator nav-label với margin trên */
.nav-label--section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Nav group collapsible */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group-toggle {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}

.nav-group-toggle:hover {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.07);
}

.nav-group-toggle[aria-expanded="true"] {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
}

.nav-group-toggle .nav-icon {
  font-size: 14px;
}

.nav-group-toggle strong {
  color: #f8fafc;
  font-size: 13px;
  display: block;
}

.nav-group-toggle small {
  color: #94a3b8;
  font-size: 10px;
  font-weight: 500;
  display: block;
}

.nav-toggle-arrow {
  color: #94a3b8;
  font-size: 12px;
  transition: transform 0.2s ease;
  line-height: 1;
}

.nav-group-toggle[aria-expanded="true"] .nav-toggle-arrow {
  transform: rotate(180deg);
}

/* Sub-items container */
.nav-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 10px;
  animation: slideDown 0.18s ease;
}

.nav-group-items[hidden] {
  display: none;
}

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

/* Nav child items */
.nav-child {
  min-height: 44px !important;
  padding: 5px 9px !important;
  border-left: 2px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 0 6px 6px 0 !important;
}

.nav-child:hover,
.nav-child.active {
  border-left-color: #38bdf8 !important;
  background: rgba(255, 255, 255, 0.06) !important;
}

.nav-child.active .nav-icon {
  background: #0f3d6d !important;
  color: #ffffff !important;
}

/* Small icon variant for sub-items */
.nav-icon--sm {
  width: 28px !important;
  height: 28px !important;
  font-size: 9px !important;
  font-weight: 700 !important;
}

.nav-button {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 7px 9px;
  border-color: transparent;
  background: transparent;
}

.nav-button::before {
  display: none;
}

.nav-button .nav-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  border-radius: 6px;
  font-size: 11px;
}

.nav-button span {
  display: grid;
  gap: 2px;
}

.nav-button strong {
  color: #f8fafc;
  font-size: 13px;
}

.nav-button small {
  color: #94a3b8;
  font-size: 10px;
  font-weight: 500;
}

.nav-button:hover,
.nav-button.active {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  transform: none;
}

.nav-button.active .nav-icon {
  border-color: #38bdf8;
  background: #0f3d6d;
  color: #ffffff;
}

.policy-note {
  grid-template-columns: 38px 1fr;
  column-gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid #38bdf8;
  background: rgba(255, 255, 255, 0.04);
}

.policy-icon {
  grid-row: 1 / 3;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #bce1cf !important;
  border-radius: 7px;
  font-size: 8px !important;
  font-weight: 900;
}

.policy-note strong {
  font-size: 11px;
}

.policy-note span:last-child {
  margin: 0;
  font-size: 10px;
}

.main {
  padding: 26px 30px 36px;
}

.topbar {
  align-items: center;
  margin-bottom: 20px;
}

.workspace-kicker {
  margin-bottom: 7px !important;
  color: var(--blue-700) !important;
  font-size: 10px !important;
  font-weight: 900;
  text-transform: uppercase;
}

.topbar h2 {
  color: var(--forest);
  font-size: 27px;
}

.topbar-context {
  min-width: 190px;
  display: grid;
  grid-template-columns: 9px 1fr;
  column-gap: 9px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  border-radius: 8px;
}

.topbar-context::before {
  content: "";
  grid-row: 1 / 3;
  align-self: center;
}

.topbar-context span,
.topbar-context strong {
  font-size: 10px;
}

.topbar-context span {
  color: var(--muted);
  text-transform: uppercase;
}

.topbar-context strong {
  color: var(--forest);
}

.summary-grid {
  gap: 12px;
  margin-bottom: 20px;
}

.summary-card {
  min-height: 108px;
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 13px;
  padding: 17px;
  border-top: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.metric-icon {
  width: 38px;
  height: 38px;
  display: grid !important;
  place-items: center;
  margin: 0 !important;
  border: 1px solid var(--mint-strong);
  background: var(--soft-blue);
  color: var(--blue-800) !important;
  border-radius: 8px;
  font-size: 10px !important;
}

.summary-card > div > span {
  display: block;
}

.summary-card strong {
  margin-top: 2px;
  color: var(--forest);
  font-size: 25px;
}

.summary-card small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
}

.summary-card.accent {
  border-top-color: var(--line);
  background: #35586b;
}

.summary-card.accent .metric-icon {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #c7e7d7 !important;
}

.summary-card.accent span,
.summary-card.accent small {
  color: rgba(242, 248, 245, 0.67);
}

.summary-card.accent strong {
  color: #fff;
  font-size: 16px;
}

.toolbar {
  align-items: stretch;
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.search-control {
  flex: 1;
  max-width: 620px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
}

.search-control span {
  padding: 0 11px;
  color: var(--blue-700);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.search-control input {
  max-width: none;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
}

.toolbar button,
.chat-form button[type="submit"],
.workflow-actions button:first-child,
.document-form button[type="submit"] {
  background: var(--blue-800);
  border-color: var(--blue-800);
}

.toolbar button:hover,
.chat-form button[type="submit"]:hover,
.document-form button[type="submit"]:hover,
.workflow-actions button:first-child:hover {
  background: var(--forest);
  border-color: var(--forest);
}

.secondary-action {
  background: #edf6f1;
  border-color: #c8e0d2;
  color: var(--blue-900);
}

.secondary-action:hover {
  background: #dfeee6;
  border-color: var(--blue-700);
  color: var(--forest);
}

.document-form {
  padding: 20px;
  border-left: 1px solid var(--line);
  border-top: 4px solid #71bb98;
  box-shadow: var(--shadow);
}

.document-form-grid label,
.attachment-review {
  color: var(--forest);
}

.document-form-grid input:focus,
.document-form-grid select:focus,
.document-form-grid textarea:focus,
.attachment-review input:focus,
.attachment-review textarea:focus {
  outline: none;
  border-color: var(--blue-700);
  box-shadow: 0 0 0 3px rgba(29, 130, 88, 0.1);
}

.draft-section {
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.draft-section > summary {
  cursor: pointer;
  list-style: none;
}

.draft-section > summary::-webkit-details-marker {
  display: none;
}

.draft-section .side-heading {
  padding: 15px 17px;
}

.draft-section .side-heading span {
  display: grid;
  gap: 3px;
  text-transform: none;
}

.draft-section .side-heading span b {
  color: var(--forest);
  font-size: 13px;
}

.draft-section .side-heading span small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.draft-list {
  margin: 0;
  padding: 0 14px 14px;
}

.draft-item {
  padding: 16px;
  background: #f8fbfd;
  border-left: 3px solid #75b99a;
}

.tag-row span {
  border-color: #c3dfcf;
  background: #edf7f1;
  color: var(--blue-900);
}

.split {
  grid-template-columns: 1fr;
  gap: 16px;
}

.panel,
.detail,
.chat-layout,
.chat-sidebar {
  box-shadow: var(--shadow-soft);
}

.panel-heading {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
}

.panel-heading div {
  display: grid;
  gap: 2px;
}

.panel-heading span {
  color: var(--forest);
  font-size: 13px;
  font-weight: 900;
}

.panel-heading small {
  color: var(--muted);
  font-size: 10px;
}

.panel-heading i {
  width: 34px;
  height: 4px;
  background: var(--mint-strong);
  border-radius: 4px;
}

th {
  background: #f3f7fa;
  color: #586c79;
  font-size: 10px;
}

td {
  padding-top: 15px;
  padding-bottom: 15px;
}

tr:hover td {
  background: #f4f9fc;
}

td strong,
.detail h3,
.detail h4,
.doc-item-title {
  color: var(--forest);
}

.detail {
  min-height: 430px;
  border-top: 4px solid #71bb98;
}

.empty-detail {
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 42px;
  text-align: center;
}

.empty-detail-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 13px;
  border: 1px solid var(--mint-strong);
  background: var(--soft-blue);
  color: var(--blue-800);
  border-radius: 8px;
  font-weight: 900;
}

.empty-detail strong {
  color: var(--forest);
}

.empty-detail p {
  max-width: 280px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.side-heading {
  background: #f3f7fa;
}

.side-heading span {
  color: var(--forest);
}

.side-heading strong {
  background: var(--blue-800);
}

.assistant-banner {
  min-height: 76px;
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 13px;
  margin-bottom: 13px;
  padding: 12px 16px;
  background: #35586b;
  color: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.assistant-orbit {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  color: #d2eddf;
  font-weight: 900;
}

.assistant-banner div:nth-child(2) {
  display: grid;
  gap: 3px;
}

.assistant-banner span {
  color: #b9dfcc;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.assistant-banner strong {
  font-size: 13px;
}

.assistant-banner i {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #d7ece1;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.chat-workspace {
  gap: 14px;
}

.chat-layout {
  height: calc(100vh - 330px);
  min-height: 510px;
  border-top-color: var(--blue-700);
}

.chat-sidebar {
  min-height: 510px;
}

.chat-messages {
  background: #fbfdff;
}

.message {
  position: relative;
  padding: 15px 17px;
  background: #f2f8fb;
  border-color: #d9e8ef;
}

.message.user {
  background: var(--blue-800);
  border-color: var(--blue-800);
}

.message a {
  color: var(--blue-800);
}

.chat-form {
  padding: 13px;
  background: #f2f7fa;
}

.chat-form input {
  min-height: 48px;
}

.doc-item {
  border-left: 3px solid var(--blue-700);
  box-shadow: 0 4px 12px rgba(25, 62, 45, 0.04);
}

.doc-item.suggested {
  border-color: #e7d1a9;
  border-left-color: var(--warning);
  background: #fffdf9;
}

.matched-attachment {
  border-color: var(--blue-700);
  background: #f0f8f5;
}

.attachment-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.replace-file {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--soft-blue);
  color: var(--blue-900);
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.replace-file input {
  display: none;
}

.drive-settings {
  max-width: 920px;
  padding: 24px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue-700);
  background: var(--panel);
  box-shadow: var(--shadow);
  border-radius: 8px;
}

.settings-heading,
.settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settings-heading span:first-child {
  color: var(--blue-700);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.settings-heading h3 {
  margin: 4px 0;
  color: var(--forest);
  font-size: 22px;
}

.settings-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.settings-status {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 22px 0;
}

.settings-status div {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #f7fafc;
  border-radius: 7px;
}

.settings-status .drive-setup-warning {
  grid-column: 1 / -1;
  border-color: #e8d4ae;
  background: #fffaf0;
}

.settings-status .drive-setup-warning strong {
  color: var(--warning);
  font-weight: 700;
  line-height: 1.5;
}

.settings-status span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.settings-status strong {
  color: var(--forest);
  font-size: 13px;
}

.settings-actions {
  justify-content: flex-start;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.cloud-oauth-form {
  display: grid;
  gap: 16px;
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.cloud-oauth-form__heading,
.cloud-oauth-submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cloud-oauth-form__heading strong {
  color: var(--forest);
  font-size: 15px;
}

.cloud-oauth-form__heading p,
.cloud-oauth-submit span {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.cloud-oauth-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.cloud-oauth-fields > label,
.cloud-oauth-field {
  display: grid;
  gap: 7px;
}

.cloud-oauth-fields label,
.field-label > label {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
}

.field-help {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.field-help__trigger {
  width: 20px;
  height: 20px;
  min-height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid #d39b2c;
  border-radius: 50%;
  background: #fff8e7;
  color: #875900;
  box-shadow: none;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.field-help__trigger:hover,
.field-help__trigger:focus-visible {
  border-color: #a96f00;
  background: #ffedbd;
  color: #684400;
  transform: none;
}

.field-help__trigger:focus-visible {
  outline: 3px solid rgba(211, 155, 44, 0.25);
  outline-offset: 2px;
}

.field-help__tooltip {
  position: absolute;
  z-index: 40;
  top: calc(100% + 9px);
  left: -8px;
  width: min(330px, calc(100vw - 56px));
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: #153344;
  color: #f5fafc;
  box-shadow: 0 12px 28px rgba(10, 36, 52, 0.24);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.55;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.field-help:hover .field-help__tooltip,
.field-help:focus-within .field-help__tooltip {
  opacity: 1;
  transform: translateY(0);
}

.cloud-oauth-fields input {
  width: 100%;
}

.cloud-oauth-fields small {
  color: var(--muted);
  font-size: 11px;
}

.cloud-oauth-redirect {
  grid-column: 1 / -1;
}

.cloud-oauth-submit {
  justify-content: flex-start;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.shared-drive-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.shared-drive-list button {
  min-height: 58px;
  display: grid;
  justify-items: start;
  gap: 3px;
  text-align: left;
}

.shared-drive-list small {
  color: var(--muted);
  font-size: 10px;
}

@media (max-width: 1180px) {
  #app {
    grid-template-columns: 218px minmax(0, 1fr);
  }

  .split {
    grid-template-columns: 1fr;
  }

  .detail {
    min-height: 260px;
  }
}

@media (max-width: 900px) {
  .corporate-header {
    height: 68px;
    flex-direction: row;
    align-items: center;
    padding: 0 18px;
  }

  .corporate-brand h1,
  .user-badge {
    display: none;
  }

  #app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 12px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
  }

  .brand,
  .policy-note {
    display: none;
  }

  .field {
    padding: 7px;
  }

  .field > span {
    display: none;
  }

  .nav {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .nav-label,
  .nav-button small {
    display: none;
  }

  .nav-button {
    grid-template-columns: 28px 1fr;
    min-height: 46px;
  }

  .nav-button .nav-icon {
    width: 27px;
    height: 27px;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-workspace {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    min-height: 420px;
  }
}

@media (max-width: 620px) {
  .corporate-header {
    height: 64px;
    flex-direction: row;
    align-items: center;
    padding: 7px 12px;
  }

  .corporate-logo {
    width: 100px;
    height: 44px;
    border-right: 0;
    padding-right: 0;
  }

  .corporate-brand > div,
  .system-status {
    display: none;
  }

  .header-actions {
    width: auto;
    flex-direction: row;
  }

  .sidebar {
    grid-template-columns: 1fr;
  }

  .field {
    display: none;
  }

  .nav-button {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 5px;
  }

  .nav-button span {
    display: none;
  }

  .main {
    padding: 18px 11px 24px;
  }

  .topbar-context {
    display: none;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .summary-card {
    min-height: 94px;
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 12px;
  }

  .metric-icon,
  .summary-card small {
    display: none !important;
  }

  .summary-card strong {
    font-size: 22px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .search-control {
    max-width: none;
    grid-column: 1 / -1;
  }

  .assistant-banner {
    grid-template-columns: 40px 1fr;
  }

  .assistant-banner i {
    display: none;
  }

  .document-form-actions,
  .draft-heading,
  .attachment-row {
    align-items: stretch;
    flex-direction: column;
  }

  .draft-meta-grid {
    grid-template-columns: 1fr;
  }

  .settings-heading,
  .settings-actions,
  .cloud-oauth-form__heading,
  .cloud-oauth-submit,
  .attachment-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-status {
    grid-template-columns: 1fr;
  }

  .cloud-oauth-fields {
    grid-template-columns: 1fr;
  }

  .cloud-oauth-redirect {
    grid-column: auto;
  }

  .field-help__tooltip {
    position: fixed;
    top: auto;
    right: 20px;
    bottom: 20px;
    left: 20px;
    width: auto;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }
}

/* Custom Pagination and Loading styles */
.pagination-controls {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: #fbfdff;
}

.pagination-layout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.btn-pag {
  padding: 6px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--blue-900);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-pag:hover:not(:disabled) {
  background: var(--blue-50);
  border-color: var(--blue-700);
  color: var(--blue-700);
}

.btn-pag:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pag-text {
  font-size: 13px;
}

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

.btn-pag.active {
  background: var(--blue-900);
  border-color: var(--blue-900);
  color: #fff;
}

.goto-page {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--slate-600);
}

.goto-page input {
  width: 50px;
  height: 28px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-weight: 700;
  outline: none;
}

.goto-page input:focus {
  border-color: var(--blue-900);
}

#chatSubmitBtn.cancel-btn {
  background: var(--red-700, #dc2626) !important;
  color: #fff !important;
  border-color: var(--red-700, #dc2626) !important;
}

#chatSubmitBtn.cancel-btn:hover {
  background: var(--red-800, #b91c1c) !important;
  border-color: var(--red-800, #b91c1c) !important;
}

/* Global Loading Spinner Overlay */
.global-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.global-loading.show {
  opacity: 1;
  pointer-events: auto;
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(38, 63, 80, 0.1);
  border-top-color: var(--blue-900);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
  box-shadow: 0 0 10px rgba(0,0,0,0.02);
}

.global-loading span {
  font-size: 14px;
  font-weight: 800;
  color: var(--blue-950);
  text-shadow: 0 1px 1px rgba(255,255,255,0.8);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Analytics Dashboard */
.analytics-dashboard {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 12px 0;
}

.analytics-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 24px;
}

.analytics-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius-md);
  padding: 20px;
}

.analytics-card h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--blue-950);
  margin-bottom: 16px;
  border-bottom: 2px solid var(--soft-blue);
  padding-bottom: 8px;
}

.analytics-card p.section-desc {
  font-size: 14px;
  color: var(--slate-600);
  margin-top: -8px;
  margin-bottom: 20px;
}

.table-container {
  overflow-x: auto;
  margin-top: 8px;
}

.analytics-table {
  min-width: 100%;
}

.analytics-table th {
  padding: 10px 12px;
}

.analytics-table td {
  padding: 10px 12px;
}

.analytics-table tr {
  cursor: default;
}

.analytics-table tr:hover td {
  background: var(--panel);
}

.approve-btn {
  background: var(--blue-900);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.approve-btn:hover {
  background: var(--blue-950);
}

/* Cấu trúc cây cho tài liệu con */
.tree-expand-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  margin-right: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 10px;
  color: var(--blue-900);
  transition: transform 0.2s;
}

.tree-expand-icon.expanded {
  transform: rotate(90deg);
}

.tree-children-row td {
  padding: 0 !important;
  background: #fcfdfe !important;
  border-top: none !important;
}

.tree-children-container {
  padding: 4px 12px 12px 42px;
  border-left: 3px solid var(--soft-blue);
  margin-left: 20px;
}

.tree-child-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
  color: var(--slate-700);
  background: #fff;
  border-radius: 4px;
  margin-top: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.tree-child-item:hover {
  background: #f4f9fc;
}

.tree-child-branch {
  font-family: monospace;
  color: var(--muted);
  margin-right: 8px;
  font-weight: bold;
}

.tree-child-icon {
  margin-right: 8px;
  font-size: 14px;
}

.tree-child-title {
  flex-grow: 1;
  font-weight: 500;
}

.tree-child-meta {
  font-size: 12px;
  color: var(--muted);
  margin-right: 16px;
}

.tree-child-actions {
  display: flex;
  gap: 12px;
}

.tree-child-actions a {
  font-size: 12px;
  text-decoration: none;
  font-weight: bold;
}

.tree-child-actions a.preview-btn {
  color: var(--blue-700);
}

.tree-child-actions a.download-btn {
  color: var(--forest);
}

/* Sơ đồ cây trong chi tiết tài liệu */
.detail-tree-container {
  background: #fcfdfd;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  margin: 12px 0;
}

.detail-tree-parent {
  font-weight: bold;
  font-size: 15px;
  color: var(--blue-950);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-tree-children {
  padding-left: 20px;
}

.detail-tree-child {
  display: flex;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  gap: 8px;
  border-bottom: 1px dashed rgba(0,0,0,0.05);
}

.detail-tree-child:last-child {
  border-bottom: none;
}

.detail-tree-child .tree-actions {
  margin-left: auto;
  display: flex;
  gap: 12px;
}

.detail-tree-child .tree-actions a {
  font-weight: bold;
}

/* Chatbot Floating Widget Iframe styling */
.chatbot-widget-iframe {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 70px;
  height: 70px;
  border: none;
  z-index: 10000;
  transition: width 0.3s cubic-bezier(0.165, 0.84, 0.44, 1), height 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  background: transparent;
  pointer-events: auto;
}

.chatbot-widget-iframe.expanded {
  width: 400px;
  height: 600px;
}

/* Toast Notification System Styles */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 10px 14px;
  border-radius: 6px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 13px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid #3b82f6;
  color: #f8fafc;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transform: translateX(120%);
  opacity: 0;
  animation: toastSlideIn 0.25s ease-out forwards;
  transition: transform 0.25s, opacity 0.25s;
}

.toast.toast-exit {
  animation: toastFadeOut 0.25s ease forwards;
}

.toast-content {
  flex-grow: 1;
  line-height: 1.45;
  font-weight: 400;
}

.toast-label {
  font-weight: 600;
  margin-right: 4px;
}

.toast-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.toast-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

/* Toast types */
.toast.success {
  border-left-color: #10b981;
}
.toast.success .toast-label {
  color: #34d399;
}

.toast.error {
  border-left-color: #ef4444;
}
.toast.error .toast-label {
  color: #f87171;
}

.toast.warning {
  border-left-color: #f59e0b;
}
.toast.warning .toast-label {
  color: #fbbf24;
}

.toast.info {
  border-left-color: #0284c7;
}
.toast.info .toast-label {
  color: #38bdf8;
}

@keyframes toastSlideIn {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastFadeOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}

/* Autocomplete Search Suggestions Styling */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 45px;
  right: 0;
  background: var(--bg-card, rgba(255, 255, 255, 0.98));
  backdrop-filter: blur(10px);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  max-height: 250px;
  overflow-y: auto;
  margin-top: 4px;
}

.suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light, #f5f5f5);
  transition: all 0.2s ease;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background: var(--bg-hover, rgba(0, 0, 0, 0.04));
}

.suggestion-title {
  font-weight: 500;
  font-size: 13px;
  color: var(--text, #333);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 75%;
}

.suggestion-meta {
  font-size: 11px;
  color: var(--muted, #666);
  background: var(--bg-badge, #f0f2f5);
  padding: 2px 6px;
  border-radius: 4px;
}

/* === MEETINGS VIEW PREMIUM STYLES === */
.meetings-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.meetings-dropzone {
  border: 2px dashed var(--line);
  background: linear-gradient(135deg, rgba(243, 246, 251, 0.6) 0%, rgba(255, 255, 255, 0.8) 100%);
  border-radius: var(--radius-md);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.meetings-dropzone::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 99, 183, 0.03);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.meetings-dropzone:hover {
  border-color: var(--blue-700);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.meetings-dropzone:hover::before {
  opacity: 1;
}

.meetings-dropzone.dragover {
  border-color: var(--blue-800);
  background: rgba(15, 99, 183, 0.06);
  transform: scale(1.02);
  box-shadow: var(--shadow);
}

.meetings-dropzone.dragover::before {
  opacity: 1;
}

/* Studio recording wave visualizer */
.soundwave-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 36px;
  padding: 0 10px;
  background: #f1f5f9;
  border-radius: 20px;
  border: 1px solid var(--line);
}

.soundwave-bar {
  width: 3px;
  height: 4px;
  background: var(--blue-800);
  border-radius: 3px;
  transition: height 0.15s ease;
}

.soundwave-container.active .soundwave-bar {
  animation: audio-wave-grow 1s ease-in-out infinite alternate;
  background: var(--red-600);
}

.soundwave-container.active .soundwave-bar:nth-child(1) { animation-delay: 0.1s; }
.soundwave-container.active .soundwave-bar:nth-child(2) { animation-delay: 0.3s; }
.soundwave-container.active .soundwave-bar:nth-child(3) { animation-delay: 0.0s; }
.soundwave-container.active .soundwave-bar:nth-child(4) { animation-delay: 0.4s; }
.soundwave-container.active .soundwave-bar:nth-child(5) { animation-delay: 0.2s; }

@keyframes audio-wave-grow {
  0% { height: 4px; }
  100% { height: 28px; }
}

/* Studio Record Button pulse animation */
.btn-studio-record {
  position: relative;
  overflow: hidden;
}

.btn-studio-record.recording {
  background: var(--red-700) !important;
  border-color: var(--red-700) !important;
  color: #fff !important;
  box-shadow: 0 0 14px rgba(215, 25, 32, 0.4);
}

/* Pulse animation for the active recording pill */
.pill-record-pulse {
  background: var(--red-600);
  color: #fff;
  border: none;
  font-weight: 800;
  animation: pulse-record-animation 1.5s infinite;
}

@keyframes pulse-record-animation {
  0% {
    box-shadow: 0 0 0 0 rgba(228, 38, 45, 0.4);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(228, 38, 45, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(228, 38, 45, 0);
  }
}

/* Auth gate: identity is established by the server session, never by a UI selector. */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(238, 245, 248, 0.96);
  backdrop-filter: blur(10px);
}

.login-gate.show { display: grid; }

.login-card {
  width: min(440px, 100%);
  padding: 32px;
  border: 1px solid #cadbe3;
  border-top: 4px solid #16845b;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(10, 44, 60, 0.16);
}

.login-brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  border-radius: 6px;
  background: #123f73;
  color: #fff;
  font-weight: 800;
}

.login-card h1 { margin: 4px 0 10px; font-size: 28px; color: #15364a; }
.login-description { margin: 0 0 20px; color: #607887; line-height: 1.55; }
.login-card label { display: grid; gap: 7px; margin-top: 14px; color: #29485a; font-weight: 700; text-align: left; }
.login-card input { min-height: 44px; padding: 0 13px; border: 1px solid #b9ccd7; border-radius: 6px; font: inherit; }
.login-card input:focus { outline: 3px solid rgba(22, 132, 91, 0.16); border-color: #16845b; }

.sso-primary-button {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  border: 1px solid #005da6;
  border-radius: 6px;
  background: #0067b8;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.sso-primary-button:hover {
  background: #005a9e;
  box-shadow: 0 4px 12px rgba(0, 103, 184, 0.25);
}
.sso-primary-button:active {
  background: #004d88;
}
.sso-hint {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: #607887;
  line-height: 1.5;
  text-align: center;
}

.login-divider {
  margin: 22px 0 16px;
  display: flex;
  align-items: center;
  text-align: center;
  color: #7b93a3;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #d3e2ea;
}
.login-divider span {
  padding: 0 12px;
}

.admin-key-toggle {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 8px 10px;
  background: none;
  border: 1px dashed #cadbe3;
  border-radius: 6px;
  color: #7b93a3;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}
.admin-key-toggle:hover {
  border-color: #16845b;
  color: #116b4a;
  background: #f1faf6;
}

.admin-login-box {
  margin-top: 14px;
  padding: 16px;
  background: #f7fafc;
  border: 1px solid #d3e2ea;
  border-radius: 6px;
  text-align: left;
}

.admin-login-notice {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: #6a8292;
  line-height: 1.45;
}

.login-submit-button {
  width: 100%;
  min-height: 44px;
  margin-top: 18px;
  border: none;
  border-radius: 6px;
  background: #16845b;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.login-submit-button:hover {
  background: #126e4b;
  box-shadow: 0 4px 12px rgba(22, 132, 91, 0.25);
}
.login-submit-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-status { min-height: 22px; margin: 16px 0 0; color: #b42318; line-height: 1.45; font-size: 13px; text-align: center; }
.logout-button { min-height: 36px; padding: 0 12px; border: 1px solid #c9d8df; border-radius: 6px; background: #fff; color: #29485a; cursor: pointer; }
.logout-button:hover { border-color: #16845b; color: #116b4a; background: #f1faf6; }

/* Operations dashboard */
.nav-home {
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-icon svg,
.module-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#dashboardView {
  display: none;
  gap: 18px;
}

#dashboardView.active {
  display: grid;
}

.dashboard-welcome {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  min-height: 134px;
  padding: 24px 28px;
  border: 1px solid #cfe0e7;
  border-left: 4px solid #25825b;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.dashboard-welcome__label {
  display: block;
  margin-bottom: 7px;
  color: #25825b;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-welcome h3 {
  margin: 0 0 7px;
  color: #173d52;
  font-size: 25px;
  line-height: 1.2;
}

.dashboard-welcome p {
  max-width: 780px;
  margin: 0;
  color: #627b89;
  font-size: 13px;
  line-height: 1.55;
}

.dashboard-date {
  display: grid;
  grid-template-columns: auto minmax(118px, 154px);
  align-items: center;
  gap: 12px;
  padding-left: 22px;
  border-left: 1px solid #dce7ee;
}

.dashboard-date strong {
  color: #1d7d59;
  font-size: 43px;
  line-height: 1;
}

.dashboard-date span {
  color: #526c7b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  text-transform: capitalize;
}

.dashboard-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.dashboard-group {
  --group-accent: #25825b;
  --group-border: #cbe7d9;
  --group-surface: #edf8f2;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--group-border);
  border-radius: 8px;
  background: var(--group-surface);
}

.dashboard-group--documents {
  --group-accent: #217da8;
  --group-border: #c9e5f0;
  --group-surface: #eaf6fb;
}

.dashboard-group--operations {
  --group-accent: #bd6b1e;
  --group-border: #f0d9bb;
  --group-surface: #fff5e8;
}

.dashboard-group--assistant {
  --group-accent: #5a61ad;
  --group-border: #d8daf3;
  --group-surface: #f0f1fc;
}

.dashboard-group--departments {
  --group-accent: #25825b;
  --group-border: #cbe7d9;
  --group-surface: #edf8f2;
}

.dashboard-group > header {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 15px;
}

.dashboard-group__icon {
  display: grid;
  flex: 0 0 36px;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 7px;
  background: var(--group-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.dashboard-group h3 {
  margin: 0 0 2px;
  color: #1d3b4c;
  font-size: 16px;
}

.dashboard-group header p {
  margin: 0;
  color: #71828d;
  font-size: 11px;
}

.dashboard-modules {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-modules--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.module-tile {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 92px;
  padding: 13px;
  overflow: hidden;
  border: 1px solid rgba(96, 127, 143, 0.2);
  border-radius: 8px;
  background: #fff;
  color: #274657;
  text-align: left;
  box-shadow: 0 4px 12px rgba(44, 77, 99, 0.05);
}

.module-tile .module-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 7px;
  background: var(--group-surface);
  color: var(--group-accent);
}

.module-tile > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.module-tile strong {
  color: #274657;
  font-size: 13px;
  line-height: 1.3;
}

.module-tile small {
  color: #778995;
  font-size: 10px;
  line-height: 1.35;
}

.module-tile i {
  position: absolute;
  right: 10px;
  bottom: 7px;
  color: var(--group-accent);
  font-size: 13px;
  font-style: normal;
  opacity: 0;
  transform: translateX(-5px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.module-tile:hover {
  border-color: var(--group-accent);
  color: #274657;
  box-shadow: 0 9px 20px rgba(44, 77, 99, 0.1);
  transform: translateY(-2px);
}

.module-tile:hover i {
  opacity: 1;
  transform: translateX(0);
}

.module-tile:focus-visible,
.department-shortcuts button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--group-accent) 28%, transparent);
  outline-offset: 2px;
}

.department-shortcuts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.department-shortcuts button {
  display: grid;
  grid-template-rows: 34px auto;
  place-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 91px;
  padding: 11px 7px;
  border: 1px solid rgba(69, 137, 104, 0.23);
  border-radius: 8px;
  background: #fff;
  color: #315364;
  text-align: center;
}

.department-shortcuts b {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: #e4f3eb;
  color: #237a57;
  font-size: 10px;
}

.department-shortcuts span {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
}

.department-shortcuts button:hover {
  border-color: #25825b;
  color: #1d684b;
  box-shadow: 0 8px 18px rgba(44, 77, 99, 0.09);
  transform: translateY(-2px);
}

[data-admin-module][hidden] {
  display: none !important;
}

@media (max-width: 1240px) {
  .dashboard-groups {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .dashboard-welcome {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .dashboard-date {
    justify-content: start;
    padding: 14px 0 0;
    border-top: 1px solid #dce7ee;
    border-left: 0;
  }

  .dashboard-modules,
  .dashboard-modules--two {
    grid-template-columns: 1fr;
  }

  .module-tile {
    min-height: 76px;
  }

  .department-shortcuts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .dashboard-group {
    padding: 15px;
  }

  .dashboard-welcome h3 {
    font-size: 21px;
  }

  .department-shortcuts {
    grid-template-columns: 1fr;
  }

  .department-shortcuts button {
    grid-template-columns: 34px minmax(0, 1fr);
    grid-template-rows: auto;
    justify-items: start;
    min-height: 58px;
    padding: 10px 12px;
    text-align: left;
  }
}

/* Compact mobile navigation: keep app modules reachable without a tall sidebar. */
@media (max-width: 620px) {
  .sidebar {
    display: block;
    padding: 8px 10px;
    overflow: hidden;
  }

  .nav {
    display: flex;
    align-items: stretch;
    gap: 7px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 1px 1px 7px;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav > .nav-button,
  .nav > .nav-group {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .nav > .nav-button {
    width: 48px;
    min-height: 48px;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 7px;
  }

  .nav-home {
    border-bottom: 0;
  }

  .nav-group {
    display: block;
  }

  .nav-group-toggle {
    display: grid;
    grid-template-columns: 30px minmax(92px, 116px) auto;
    width: auto;
    min-height: 48px;
    padding: 5px 7px;
    border-color: rgba(255, 255, 255, 0.1);
    border-radius: 7px;
  }

  .nav-group-toggle strong,
  .nav-group-toggle small {
    white-space: nowrap;
  }

  .nav-group-items {
    display: none !important;
  }
}

/* ==========================================================================
   Document Quick Preview Drawer
   ========================================================================== */
.doc-preview-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.doc-preview-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.doc-preview-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 580px;
  max-width: 92vw;
  height: 100vh;
  background: #ffffff;
  z-index: 1250;
  box-shadow: -8px 0 30px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.doc-preview-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background: #ffffff;
}

.drawer-header-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.drawer-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.drawer-title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
  word-break: break-word;
}

.drawer-submeta {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.drawer-close-btn {
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.drawer-close-btn:hover {
  background: #f1f5f9;
  color: var(--ink);
  border-color: #cbd5e1;
  transform: none;
}

.drawer-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.drawer-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  min-height: 32px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.drawer-tool-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--ink);
  transform: none;
}

.drawer-tool-btn.primary {
  background: #0f3d6d;
  color: #ffffff;
  border-color: #0f3d6d;
}

.drawer-tool-btn.primary:hover {
  background: #0c3158;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
}

.drawer-summary-card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #1e293b;
}

.drawer-callout-ai {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 3px solid #3b82f6;
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  color: #1e3a8a;
}

.drawer-tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.drawer-rbac-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}

.drawer-rbac-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12.5px;
}

.drawer-rbac-col .muted-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.drawer-rbac-col strong {
  color: var(--ink);
}

.drawer-details summary {
  padding: 6px 0;
  font-weight: 600;
  color: #0f3d6d;
  display: flex;
  align-items: center;
  gap: 7px;
}

.drawer-full-content {
  margin-top: 8px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  max-height: 280px;
  overflow-y: auto;
  white-space: pre-wrap;
  color: #334155;
}

.drawer-attachments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-att-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.drawer-att-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.drawer-att-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
  background: #f1f5f9;
  color: #0f3d6d;
  display: grid;
  place-items: center;
  border-radius: 6px;
}

.drawer-att-info {
  flex: 1;
  min-width: 0;
}

.drawer-att-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-att-meta {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-att-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.drawer-btn-sm {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  min-height: 28px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #334155;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.drawer-btn-sm:hover {
  background: #f1f5f9;
  color: var(--ink);
  border-color: #cbd5e1;
}

.drawer-btn-sm.primary {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.drawer-btn-sm.primary:hover {
  background: #dbeafe;
}

.drawer-empty-att {
  padding: 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

/* ==========================================================================
   Allowed External Emails Management (M365 SSO)
   ========================================================================== */
.allowed-emails-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 15px;
}

.allowed-email-card,
.allowed-list-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.allowed-email-card .card-heading,
.allowed-list-card .card-heading {
  margin-bottom: 16px;
}

.allowed-email-card .card-heading strong,
.allowed-list-card .card-heading strong {
  font-size: 15px;
  color: #0f172a;
  display: block;
}

.allowed-email-card .card-heading p {
  font-size: 12.5px;
  color: #64748b;
  margin: 3px 0 0;
}

.allowed-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.allowed-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.allowed-form-group label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.allowed-form-group input {
  height: 38px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 13px;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s ease;
}

.allowed-form-group input:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.12);
}

.allowed-form-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.allowed-form-actions button.primary-btn {
  height: 38px;
  padding: 0 18px;
  background: #0f3d6d;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.allowed-form-actions button.primary-btn:hover {
  background: #0c3158;
}

.allowed-table-container {
  overflow-x: auto;
}

.allowed-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.allowed-table thead th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.allowed-table tbody td {
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

.allowed-table tbody tr:hover {
  background: #f8fafc;
}

.allowed-table .table-empty {
  text-align: center;
  padding: 30px 12px;
  color: #94a3b8;
  font-style: italic;
}

.btn-revoke {
  padding: 4px 10px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #e11d48;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-revoke:hover {
  background: #ffe4e6;
  border-color: #fda4af;
  color: #be123c;
  }

/* ── Procurement Workflow Stepper & Detail Styles ─────────────────────────── */
.wf-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 12px 4px 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.wf-step-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  transition: all 0.2s ease;
}

.wf-step-badge.completed {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.wf-step-badge.active {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e40af;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.wf-step-badge.pending {
  opacity: 0.65;
}

.wf-step-arrow {
  color: var(--line);
  font-size: 13px;
  user-select: none;
}

.wf-step-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.wf-step-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 10px;
}

.wf-step-header h4 {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--ink);
  font-weight: 700;
}

.wf-step-header p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

.wf-action-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.wf-card-block {
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
}

.wf-doc-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}

.wf-doc-btn:hover {
  background: #0369a1;
}

.wf-doc-btn.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.wf-doc-btn.secondary:hover {
  background: var(--panel);
  border-color: #94a3b8;
}

.wf-checklist-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.wf-check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 12.5px;
}

.wf-check-row.present {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.wf-check-row.missing {
  border-color: #fed7aa;
  background: #fffbeb;
  color: #9a3412;
}

.wf-signed-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #ecfdf5;
  color: #065f46;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid #a7f3d0;
}

.wf-timeline-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.wf-timeline-item {
  position: relative;
  padding-left: 20px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.wf-timeline-item::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0284c7;
}

.wf-timeline-item strong {
  color: var(--ink);
}

/* ==========================================================================
   WORKFLOW SOP MASTER-DETAIL 2-COLUMN LAYOUT & SIDEBAR EXPAND/COLLAPSE
   ========================================================================== */
.wf-sop-master-detail {
  display: grid !important;
  grid-template-columns: 360px minmax(0, 1fr) !important;
  gap: 16px !important;
  align-items: start !important;
  width: 100%;
  transition: grid-template-columns 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.wf-sop-master-detail.is-collapsed {
  display: block !important;
}

.wf-sop-master-detail.is-collapsed .wf-sop-sidebar {
  display: none !important;
}

.wf-sop-sidebar {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  transition: opacity 0.2s ease, width 0.22s ease;
}

.wf-sop-main-detail {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 992px) {
  .wf-sop-master-detail {
    grid-template-columns: 1fr !important;
  }
  .wf-sop-master-detail.is-collapsed {
    grid-template-columns: 1fr !important;
  }
  .wf-sop-master-detail.is-collapsed .wf-sop-sidebar {
    display: none !important;
  }
}

.wf-step-editor-item {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  position: relative;
}

.wf-step-editor-item:hover {
  border-color: #cbd5e1;
}

