:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #101828;
  --muted: #667085;
  --line: #d0d5dd;
  --primary: #175cd3;
  --primary-dark: #1849a9;
  --danger: #b42318;
  --warning: #b54708;
  --success: #067647;
  --nav: #111827;
  --shadow: 0 20px 70px rgba(16, 24, 40, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  background: radial-gradient(circle at 20% 0%, #243b6b 0, #111827 44%, #0b1220 100%);
  color: #f8fafc;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

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

.brand p {
  margin: 3px 0 0;
  color: #cbd5e1;
  font-size: 13px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #ffffff;
  color: var(--primary-dark);
  font-weight: 800;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

.brand-mark.large {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.nav button {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 9px 10px;
  border-radius: 10px;
  background: transparent;
  color: #dbe4f0;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 12px;
  font-weight: 800;
}

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

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(120deg, rgba(23, 92, 211, 0.92), rgba(6, 118, 71, 0.88)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cpath fill='none' stroke='%23ffffff' stroke-opacity='.2' d='M20 20h140v140H20zM60 20v140M100 20v140M20 60h140M20 100h140'/%3E%3C/svg%3E");
}

.login-card {
  width: min(860px, 100%);
  display: grid;
  grid-template-columns: 1fr 380px;
  overflow: hidden;
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-copy {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 42px;
  background: #f8fafc;
}

.login-copy h1 {
  margin: 0;
  font-size: 34px;
}

.login-copy p,
.hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.login-form {
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 42px;
}

.login-form label,
.field span {
  color: #475467;
  font-size: 13px;
  font-weight: 700;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
}

.account-bar span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.account-actions,
.row-actions,
.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

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

.page-head h2 {
  margin: 0;
  font-size: 30px;
}

.page-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

.btn {
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}

.btn:hover {
  background: var(--primary-dark);
}

.btn.ghost {
  background: #eef4ff;
  color: var(--primary-dark);
}

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

.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(23, 92, 211, 0.12);
}

.textarea {
  min-height: 110px;
  resize: vertical;
}

.notice {
  margin-bottom: 16px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--muted);
}

.notice.error {
  border-color: #fecdca;
  background: #fffbfa;
  color: var(--danger);
}

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

.metric {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 12px 36px rgba(16, 24, 40, 0.06);
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
}

.metric.danger strong {
  color: var(--danger);
}

.metric.warning strong {
  color: var(--warning);
}

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

.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 12px 36px rgba(16, 24, 40, 0.06);
}

.panel-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3 {
  margin: 0;
  font-size: 17px;
}

.list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.compact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #eaecf0;
  border-radius: 14px;
  background: var(--surface-soft);
}

.compact-card h4 {
  margin: 0;
  font-size: 15px;
}

.compact-card p,
td p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.module-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.module-strip button {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  text-align: left;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px 190px;
  gap: 10px;
  margin-bottom: 14px;
}

.table-panel {
  overflow-x: auto;
}

.document-browser {
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
}

.document-toolbar {
  display: block;
  padding: 24px 30px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.document-breadcrumbs {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  max-width: 100%;
  min-height: 52px;
  padding: 9px;
  border: 1px solid #d6e4ff;
  border-radius: 14px;
  background: #eef6ff;
  box-shadow: 0 10px 24px rgba(23, 92, 211, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.breadcrumb-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  max-width: 280px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.breadcrumb-chip span:last-child,
.breadcrumb-chip:not(.breadcrumb-root) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumb-chip:hover {
  border-color: #b2ccff;
  background: #ffffff;
}

.breadcrumb-separator {
  color: #528bff;
  font-size: 25px;
  line-height: 1;
  font-weight: 800;
}

.document-table-wrap {
  overflow-x: auto;
  padding: 24px 34px 44px;
}

.document-browser .document-toolbar {
  padding: 26px 30px;
}

.document-browser .document-breadcrumbs {
  width: fit-content;
  min-width: min(520px, 100%);
  padding: 12px;
  border: 1px solid #c7d7fe;
  border-radius: 16px;
  background: #eef6ff;
}

.document-browser button.breadcrumb-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #ffffff;
  color: #1849a9;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}

.document-browser button.breadcrumb-chip:hover {
  border-color: #84adff;
  background: #f8fbff;
}

.document-browser .breadcrumb-separator {
  color: #528bff;
  font-size: 26px;
  font-weight: 900;
}

.document-table {
  min-width: 880px;
  border-collapse: separate;
  border-spacing: 0;
}

.document-table th,
.document-table td {
  height: 64px;
  border-bottom: 1px solid #eef2f6;
}

.document-table th {
  height: 42px;
  background: #f8fafc;
  color: #344054;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.document-row {
  cursor: default;
}

.document-row.folder-row {
  cursor: pointer;
}

.document-row:hover {
  background: #f8fbff;
}

.select-col {
  width: 54px;
}

.fake-check {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #eef2f6;
}

.document-name {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.document-name strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-name small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.doc-folder-icon,
.doc-file-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 24px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 900;
}

.doc-folder-icon {
  position: relative;
  background: #5f6368;
  flex: 0 0 auto;
  margin-top: 2px;
}

.doc-folder-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  top: -5px;
  width: 14px;
  height: 8px;
  border-radius: 4px 4px 0 0;
  background: inherit;
}

.document-breadcrumbs .doc-folder-icon,
.folder-row:hover .doc-folder-icon {
  background: var(--primary);
}

.doc-file-icon {
  background: #eef2f6;
  color: #667085;
}

.doc-file-icon.pdf {
  background: #fee4e2;
  color: #d92d20;
}

.doc-file-icon.image {
  background: #ecfdf3;
  color: #039855;
}

.doc-file-icon.word {
  background: #dbeafe;
  color: #1d4ed8;
}

.doc-file-icon.sheet {
  background: #dcfce7;
  color: #15803d;
}

.document-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}

.document-sidebar {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 12px;
}

.document-sidebar button {
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.document-sidebar .folder-tree-row {
  display: block;
  padding-left: calc(12px + var(--level, 0) * 26px);
}

.document-sidebar .folder-tree-row span {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-sidebar .folder-tree-row.nested span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 1px;
  margin-right: 8px;
  vertical-align: middle;
  background: #98a2b3;
}

.document-sidebar button.active,
.document-sidebar button:hover {
  background: #eef4ff;
  color: var(--primary-dark);
}

.document-panel {
  overflow: hidden;
}

.document-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.document-panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.document-grid {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.document-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #eaecf0;
  border-radius: 14px;
  background: var(--surface-soft);
}

.folder-card {
  cursor: pointer;
}

.document-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #eef4ff;
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 900;
}

.document-icon.file {
  background: #ecfdf3;
  color: var(--success);
}

.document-card h4 {
  margin: 0;
  font-size: 15px;
}

.document-card p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.document-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.document-table .document-actions .btn {
  min-height: 34px;
  padding: 8px 11px;
  border-radius: 9px;
  font-size: 13px;
}

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

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid #eaecf0;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: #475467;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f2f4f7;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.pill.red {
  background: #fee4e2;
  color: var(--danger);
}

.pill.green {
  background: #dcfae6;
  color: var(--success);
}

.pill.amber {
  background: #fef0c7;
  color: var(--warning);
}

.pill.blue {
  background: #d1e9ff;
  color: var(--primary-dark);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.55);
}

.modal {
  width: min(780px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.28);
}

.modal header,
.modal footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.modal footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal h3 {
  margin: 0;
}

.modal p {
  margin: 4px 0 0;
  color: var(--muted);
}

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

.profile-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 18px 18px 0;
}

.profile-summary div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #eaecf0;
  border-radius: 14px;
  background: #f8fafc;
}

.profile-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.profile-summary strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.role-access {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.role-access legend {
  padding: 0 6px;
  color: #475467;
  font-size: 13px;
  font-weight: 700;
}

.role-access label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
}

.module-access {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.module-access legend {
  padding: 0 6px;
  color: #475467;
  font-size: 13px;
  font-weight: 800;
}

.module-access label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #eaecf0;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.module-access-default {
  opacity: 0.75;
}

.comments-section {
  display: grid;
  gap: 12px;
  margin: 0 18px 18px;
  padding: 16px;
  border: 1px solid #eaecf0;
  border-radius: 16px;
  background: #f8fafc;
}

.comments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.comments-head h4 {
  margin: 0;
  font-size: 16px;
}

.comments-head span {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
}

.readonly-list {
  display: grid;
  gap: 8px;
}

.readonly-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.readonly-item span {
  color: #667085;
  font-size: 13px;
}

.comments-list {
  display: grid;
  gap: 10px;
  max-height: 260px;
  overflow: auto;
}

.comment-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #eaecf0;
  border-radius: 14px;
  background: #fff;
}

.comment-item div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.comment-item span {
  color: var(--muted);
  font-size: 12px;
}

.comment-item p {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
  white-space: pre-wrap;
}

.comment-form {
  display: grid;
  gap: 10px;
}

.comment-form .textarea {
  min-height: 82px;
}

.empty {
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.empty.compact {
  padding: 16px;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

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

@media (max-width: 720px) {
  .main {
    padding: 16px;
  }

  .login-card,
  .kpi-grid,
  .dashboard-grid,
  .module-strip,
  .document-layout,
  .filters,
  .profile-summary,
  .form {
    grid-template-columns: 1fr;
  }

  .login-copy,
  .login-form {
    padding: 24px;
  }

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

  .page-head,
  .account-bar,
  .document-card {
    display: grid;
  }

  .document-toolbar {
    display: grid;
    padding: 14px;
  }

  .document-table-wrap {
    padding: 18px 14px 24px;
  }

  .document-table {
    min-width: 760px;
  }

  .document-actions {
    justify-content: flex-start;
  }

  .field.full {
    grid-column: auto;
  }
}
