:root {
  --tm-bg: #f3f6fa;
  --tm-panel: #ffffff;
  --tm-line: #e2e8f0;
  --tm-line-soft: #edf1f5;
  --tm-text: #142033;
  --tm-muted: #64748b;
  --tm-navy: #1f3a57;
  --tm-navy-soft: #e9eff5;
  --tm-teal: #0f766e;
  --tm-teal-soft: #e6f4f1;
  --tm-red: #b3261e;
  --tm-red-soft: #fbe9e7;
  --tm-amber: #b36a16;
  --tm-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 18px rgba(16, 24, 40, .045);
}

body {
  background: var(--tm-bg);
  color: var(--tm-text);
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr);
  gap: 24px;
  min-height: 68px;
  padding: 0 24px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--tm-line);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
  backdrop-filter: blur(12px);
}

.topbar::before {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 220px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--tm-navy);
  box-shadow: 0 8px 18px rgba(31, 58, 87, .22);
  color: #fff;
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

.brand-sub {
  display: block;
  margin-top: 2px;
  color: var(--tm-muted);
  font-size: 11px;
  font-weight: 600;
}

.menu-btn {
  display: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--tm-line);
  border-radius: 8px;
  background: #fff;
  color: var(--tm-navy);
}

.search-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.search-field {
  display: flex;
  flex: 0 1 520px;
  align-items: center;
  min-width: 180px;
  overflow: visible;
  background: #fff;
  border: 1px solid var(--tm-line);
  border-radius: 8px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.search-field:focus-within {
  border-color: var(--tm-navy);
  box-shadow: 0 0 0 3px rgba(31, 58, 87, .1);
  background: #fff;
}

.search-mode-switch {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
  margin: 0 8px 0 0;
  padding: 3px;
  border-radius: 7px;
  background: #edf1f5;
}

.search-mode-btn {
  height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #60748a;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.search-mode-btn:hover {
  color: var(--tm-navy);
}

.search-mode-btn.active {
  background: var(--tm-navy);
  color: #fff;
  box-shadow: 0 1px 3px rgba(31, 58, 87, .24);
}

.search-field input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 8px 0 36px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}

.search-field .search-clear {
  position: static;
  flex: 0 0 auto;
  margin: 0 6px 0 0;
  transform: none;
}

.search-field input:focus,
.search-field input:focus-visible {
  outline: 0;
  box-shadow: none;
}

.search-field::after {
  display: none;
}

.search-btn,
.topbar .ghost-btn {
  height: 40px;
  border-radius: 8px;
}

.search-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  border: 1px solid var(--tm-navy);
  background: var(--tm-navy);
  color: #fff;
  font-weight: 600;
}

.search-btn:hover {
  background: #162c43;
  border-color: #162c43;
}

.topbar .ghost-btn {
  background: #fff;
  border-color: var(--tm-line);
  color: #425466;
}

.topbar .ghost-btn:hover {
  border-color: var(--tm-navy);
  color: var(--tm-navy);
}

.layout {
  align-items: flex-start;
  gap: 20px;
  max-width: 1440px;
  padding: 20px 24px 56px;
}

.sidebar {
  position: sticky;
  top: 84px;
  z-index: 40;
  width: 250px;
  max-height: calc(100vh - 104px);
  padding: 12px 10px 14px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--tm-line);
  border-radius: 10px;
  box-shadow: var(--tm-shadow);
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #d8e0e8;
}

.sidebar-close {
  display: none;
}

.sidebar-title {
  margin: 18px 8px 8px;
  padding: 0;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.side-nav {
  display: grid;
  gap: 3px;
  margin: 0;
}

.side-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #52657a;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.side-item svg {
  flex: 0 0 auto;
  color: #7b8ca1;
}

.side-item span {
  white-space: nowrap;
}

.side-item:hover {
  background: var(--tm-navy-soft);
  color: var(--tm-navy);
}

.side-item:hover svg {
  color: var(--tm-navy);
}

.side-item.active {
  background: var(--tm-navy-soft);
  color: var(--tm-navy);
  font-weight: 700;
}

.side-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--tm-red);
}

.side-item.active svg {
  color: var(--tm-navy);
}

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

.category-nav .nav-item {
  min-height: 38px;
  padding: 7px 10px 7px 13px;
  border-radius: 7px;
  color: #52657a;
}

.category-nav .nav-item.active {
  background: var(--tm-red-soft);
  border-color: transparent;
  color: var(--tm-red);
  font-weight: 600;
}

.category-nav .nav-item.active::before {
  background: var(--tm-red);
}

.category-nav .nav-item.active .nav-count {
  color: var(--tm-red);
}

.sidebar-stats {
  margin: 12px 4px 0;
  padding: 12px;
  border: 1px solid var(--tm-line-soft);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--tm-muted);
  line-height: 1.9;
  font-size: 12px;
}

.content {
  min-width: 0;
}

.view-panel {
  width: 100%;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
}

.page-heading h2 {
  margin: 3px 0 4px;
  color: var(--tm-text);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
}

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

.page-heading-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.eyebrow {
  display: block;
  color: var(--tm-red);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.stat-card {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--tm-line);
  border-radius: 8px;
  box-shadow: var(--tm-shadow);
}

.stat-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

.stat-icon-navy {
  color: var(--tm-navy);
  background: var(--tm-navy-soft);
}

.stat-icon-teal {
  color: var(--tm-teal);
  background: var(--tm-teal-soft);
}

.stat-icon-amber {
  color: var(--tm-amber);
  background: #fdf3e5;
}

.stat-icon-red {
  color: var(--tm-red);
  background: var(--tm-red-soft);
}

.stat-card > div {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.stat-label {
  flex-basis: 100%;
  color: var(--tm-muted);
  font-size: 12px;
  font-weight: 600;
}

.stat-card strong {
  color: var(--tm-text);
  font-size: 27px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-card em {
  color: var(--tm-muted);
  font-size: 12px;
  font-style: normal;
}

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

.panel-box {
  min-width: 0;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--tm-line);
  border-radius: 8px;
  box-shadow: var(--tm-shadow);
}

.storage-panel {
  grid-column: span 4;
}

.category-panel {
  grid-column: span 8;
}

.recent-panel {
  grid-column: span 7;
}

.activity-panel {
  grid-column: span 5;
}

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

.panel-head h3 {
  margin: 4px 0 0;
  color: var(--tm-text);
  font-size: 16px;
  line-height: 1.3;
}

.panel-note {
  color: var(--tm-navy);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.panel-link {
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--tm-red);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.panel-link:hover {
  background: var(--tm-red-soft);
}

.panel-copy {
  margin: 14px 0 0;
  color: var(--tm-muted);
  font-size: 12px;
  line-height: 1.7;
}

.storage-meter {
  margin: 4px 0 0;
}

.storage-meter-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf2;
}

#storage-bar-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--tm-navy), var(--tm-teal));
  transition: width .5s ease;
}

.storage-legend {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
  color: var(--tm-muted);
  font-size: 11px;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
}

.legend-dot.navy {
  background: var(--tm-navy);
}

.legend-dot.teal {
  background: var(--tm-teal);
}

.category-overview-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 20px;
}

.category-overview-item {
  display: grid;
  grid-template-columns: minmax(70px, 1fr) 1fr 30px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--tm-text);
  cursor: pointer;
  text-align: left;
}

.category-overview-item:hover .cat-name {
  color: var(--tm-red);
}

.cat-name {
  overflow: hidden;
  color: #52657a;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f5;
}

.cat-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--tm-navy), #4f7196);
}

.category-overview-item b {
  color: var(--tm-muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.overview-recent-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.overview-file-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--tm-line-soft);
  border-radius: 7px;
  background: #fbfcfe;
  color: var(--tm-text);
  cursor: pointer;
  text-align: left;
}

.overview-file-row:hover {
  border-color: #cbd7e3;
  background: #f5f8fb;
}

.mini-pdf {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 31px;
  border-radius: 6px;
  background: var(--tm-red);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
}

.overview-file-main {
  display: block;
  min-width: 0;
}

.overview-file-main strong {
  display: block;
  overflow: hidden;
  color: #263b50;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-file-main em {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--tm-muted);
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-activity-list {
  display: grid;
  gap: 7px;
}

.activity-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--tm-line-soft);
  border-radius: 7px;
  background: #fbfcfe;
}

.activity-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--tm-teal);
  box-shadow: 0 0 0 3px var(--tm-teal-soft);
}

.activity-row div {
  min-width: 0;
}

.activity-row strong {
  display: block;
  color: #263b50;
  font-size: 12px;
  font-weight: 700;
}

.activity-row span {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--tm-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-empty {
  padding: 14px;
  border: 1px dashed #dbe4ec;
  border-radius: 8px;
  background: #fafbfd;
  color: var(--tm-muted);
  font-size: 12px;
  text-align: center;
}

.filters {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--tm-line);
  border-radius: 8px;
  box-shadow: var(--tm-shadow);
}

.filter-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.mode-switch {
  display: inline-flex;
  gap: 3px;
  margin: 0;
  padding: 3px;
  border-radius: 8px;
  background: #edf1f5;
}

.mode-btn {
  height: 32px;
  padding: 0 15px;
  border-radius: 6px;
  color: var(--tm-muted);
  font-size: 13px;
  font-weight: 600;
}

.mode-btn.active {
  background: #fff;
  border-color: #fff;
  color: var(--tm-navy);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}

.view-toggle {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--tm-line);
  border-radius: 8px;
  background: #fff;
}

.view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #8ba0b3;
  cursor: pointer;
}

.view-btn:hover {
  color: var(--tm-navy);
}

.view-btn.active {
  background: var(--tm-navy);
  color: #fff;
  box-shadow: 0 1px 4px rgba(31, 58, 87, .25);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filters select {
  height: 36px;
  border-color: var(--tm-line);
  border-radius: 7px;
  background: #fff;
  color: #334155;
  font-size: 13px;
}

.filter-row select {
  width: 160px;
}

.filters select:focus {
  border-color: var(--tm-navy);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(31, 58, 87, .1);
}

.active-filters {
  padding-top: 11px;
  border-color: var(--tm-line);
}

.filter-chip {
  border-color: #cbd7e3;
  background: #f5f8fb;
  color: #3f5367;
}

.stat-line {
  align-items: center;
  margin: 11px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--tm-line);
  color: var(--tm-muted);
}

.stat-line .result-count {
  color: var(--tm-text);
  font-weight: 600;
}

.results {
  display: block;
  min-height: 180px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--tm-line);
  border-radius: 8px;
  padding: 0 14px;
  box-shadow: var(--tm-shadow);
}

.result-item {
  display: grid;
  grid-template-areas: "badge info actions";
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 14px;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--tm-line-soft);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.result-item:last-child {
  border-bottom: 0;
}

.result-item:hover {
  background: #fbfdff;
  border-color: var(--tm-line-soft);
  box-shadow: none;
  transform: none;
}

.file-badge {
  grid-area: badge;
  width: 42px;
  height: 42px;
  border-radius: 6px;
  background: var(--tm-red);
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, .13) 0 42%, transparent 42% 100%),
    radial-gradient(circle 2px at 10px 10px, rgba(255, 255, 255, .8) 99%, transparent);
  box-shadow: none;
  color: #fff;
  font-size: 11px;
  letter-spacing: 0;
}

.file-badge::after {
  display: none;
}

.file-info {
  grid-area: info;
  min-width: 0;
}

.file-title-row {
  align-items: flex-start;
  gap: 6px;
}

.file-name {
  margin: 1px 0 5px;
  color: #1c2d40;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.file-meta {
  margin: 0 0 6px;
  color: #8296aa;
  font-size: 12px;
}

.fav-btn {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-top: -3px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: #a4b4c2;
  font-size: 17px;
  line-height: 1;
}

.fav-btn:hover {
  border-color: #f4d4a0;
  background: #fff8e8;
  color: var(--tm-amber);
}

.fav-btn.active {
  background: #fff8e8;
  border-color: #f3d9a9;
  color: var(--tm-amber);
}

.chip-line {
  gap: 5px;
  margin: 7px 0 0;
}

.chip {
  max-width: 160px;
  overflow: hidden;
  padding: 3px 8px;
  background: var(--tm-navy-soft);
  color: #33526e;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip.dup {
  background: #fdf0e5;
  color: var(--tm-amber);
}

.file-side-actions {
  grid-area: actions;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.file-side-actions:empty {
  display: none;
}

.file-delete {
  height: 40px;
  min-width: 92px;
  padding: 0 20px;
  border: 1px solid var(--tm-red);
  border-radius: 7px;
  background: var(--tm-red);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.file-delete:hover,
.file-delete:active,
.file-delete:focus-visible {
  background: var(--tm-red);
  border-color: var(--tm-red);
  color: #fff;
  box-shadow: 0 6px 14px rgba(179, 38, 30, .18);
}

mark {
  background: #ffe58a;
  color: #4a3a00;
}

.pagination {
  margin-top: 20px;
}

.pagination .ghost-btn {
  height: 36px;
  border-radius: 7px;
}

.empty-state {
  padding: 54px 20px;
}

.empty-state.compact {
  grid-column: 1 / -1;
  padding: 44px 16px;
  background: #fff;
  border: 1px dashed var(--tm-line);
  border-radius: 8px;
}

.empty-mark {
  background: var(--tm-navy-soft);
  color: var(--tm-navy);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: flex;
  justify-content: flex-end;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(2px);
}

.drawer-panel {
  position: relative;
  width: min(420px, 100%);
  height: 100%;
  padding: 22px;
  overflow-y: auto;
  background: #fff;
  box-shadow: -16px 0 40px rgba(15, 23, 42, .18);
  animation: drawer-in .22s ease;
}

@keyframes drawer-in {
  from {
    transform: translateX(24px);
    opacity: .6;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

.drawer-head h2 {
  margin: 4px 0 0;
  color: var(--tm-text);
  font-size: 18px;
  line-height: 1.45;
  word-break: break-word;
}

.drawer-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--tm-line);
  border-radius: 8px;
  background: #fff;
  color: var(--tm-muted);
  font-size: 22px;
  line-height: 1;
}

.drawer-close:hover {
  border-color: var(--tm-red);
  color: var(--tm-red);
}

.pdf-cover {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 208px;
  padding: 17px;
  overflow: hidden;
  background: var(--tm-red);
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, .12) 0 36%, transparent 36% 100%),
    radial-gradient(circle 22px at 92% 12%, rgba(255, 255, 255, .13) 99%, transparent);
  border-radius: 10px;
  color: #fff;
  box-shadow: 0 12px 26px rgba(179, 38, 30, .2);
}

.pdf-cover-photo {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.pdf-cover.has-cover {
  min-height: 232px;
  padding: 0;
  background: #f1f5f9;
  color: #fff;
  box-shadow: 0 12px 26px rgba(15, 23, 42, .14);
}

.pdf-cover.has-cover .pdf-cover-top,
.pdf-cover.has-cover .pdf-cover-lines,
.pdf-cover.has-cover > strong {
  display: none;
}

.pdf-cover-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
}

.pdf-cover-top span {
  font-size: 13px;
  font-weight: 800;
}

.pdf-cover-lines {
  display: grid;
  gap: 7px;
  margin-top: 18px;
}

.pdf-cover-lines i {
  display: block;
  width: 56%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .42);
}

.pdf-cover-lines i:nth-child(2) {
  width: 78%;
  background: rgba(255, 255, 255, .62);
}

.pdf-cover-lines i:nth-child(3) {
  width: 42%;
}

.pdf-cover-lines i:nth-child(4),
.pdf-cover-lines i:nth-child(5) {
  display: none;
}

.pdf-cover strong {
  margin-top: auto;
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 18px 0 0;
  overflow: hidden;
  border: 1px solid var(--tm-line);
  border-radius: 8px;
  background: var(--tm-line);
}

.detail-meta > div {
  min-width: 0;
  padding: 11px 12px;
  background: #fff;
}

.detail-meta span {
  display: block;
  margin-bottom: 4px;
  color: var(--tm-muted);
  font-size: 11px;
}

.detail-meta strong {
  display: block;
  overflow: hidden;
  color: var(--tm-text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.drawer-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--tm-line);
}

.drawer-actions button {
  width: 100%;
  height: 42px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
}

.drawer-open {
  border-color: var(--tm-navy);
  background: var(--tm-navy);
  color: #fff;
}

.drawer-fav.active {
  border-color: #e6b55e;
  background: #fff8e8;
  color: var(--tm-amber);
}

.danger-btn {
  height: 42px;
  border: 1px solid var(--tm-red);
  border-radius: 8px;
  background: var(--tm-red);
  color: #fff;
}

.danger-btn:hover,
.danger-btn:active {
  background: var(--tm-red);
  border-color: var(--tm-red);
  color: #fff;
}

.toast {
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .22);
}

.modal-panel {
  border-radius: 10px;
}

.primary-btn,
.ghost-btn,
.icon-btn {
  border-radius: 7px;
}

@media (max-width: 1180px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .storage-panel,
  .category-panel,
  .recent-panel,
  .activity-panel {
    grid-column: auto;
  }

  .category-overview-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding: 10px 14px;
    align-items: center;
  }

  .brand {
    min-width: 0;
  }

  .menu-btn {
    display: inline-flex;
    order: -1;
    grid-column: 1;
    grid-row: 1;
  }

  .brand {
    grid-column: 2;
    grid-row: 1;
  }

  .search-wrap {
    grid-column: 1 / -1;
    grid-row: 2;
    flex-wrap: wrap;
  }

  .search-field {
    flex: 1 1 100%;
    min-width: 0;
  }

  .search-wrap > .ghost-btn {
    flex: 1 1 auto;
  }

  .layout {
    display: block;
    padding: 12px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 160;
    width: min(292px, 86vw);
    height: 100vh;
    max-height: none;
    margin: 0;
    padding: 18px 12px 24px;
    border: 0;
    border-radius: 0;
    box-shadow: 14px 0 40px rgba(15, 23, 42, .16);
    transform: translateX(-105%);
    transition: transform .22s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--tm-line);
    border-radius: 8px;
    background: #fff;
    color: var(--tm-muted);
    font-size: 21px;
    line-height: 1;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 150;
    background: rgba(15, 23, 42, .45);
  }

  .content {
    width: 100%;
    max-width: none;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .page-heading-actions {
    width: 100%;
  }

  .page-heading-actions .ghost-btn {
    flex: 1;
  }

}

@media (max-width: 700px) {
  .brand {
    min-width: 0;
  }

  .brand h1 {
    font-size: 15px;
  }

  .brand-sub {
    display: none;
  }

  .topbar > .search-wrap > .ghost-btn {
    padding: 0 11px;
    font-size: 13px;
  }

  #rebuild-btn,
  #users-btn,
  #logs-btn,
  #trash-btn {
    display: none !important;
  }

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

  .overview-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .panel-box {
    padding: 14px;
  }

  .category-overview-list {
    grid-template-columns: 1fr;
  }

  .results {
    padding: 0 10px;
  }

  .result-item {
    grid-template-columns: 40px minmax(0, 1fr);
    grid-template-areas: "badge info" "actions actions";
    gap: 8px 10px;
    padding: 10px 0;
  }

  .file-side-actions:not(:empty) {
    justify-content: flex-end;
    padding-top: 7px;
    border-top: 1px dashed var(--tm-line);
  }

  .filter-topline {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-row {
    flex-wrap: wrap;
  }

  .filters select,
  .filter-row select {
    width: 100%;
    flex: 1 1 100%;
  }

  .view-toggle {
    align-self: flex-end;
  }

  .drawer-panel {
    width: 100%;
  }

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

@media (max-width: 440px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    padding: 13px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .search-wrap > .ghost-btn {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .drawer-panel,
  .sidebar {
    animation: none;
    transition: none;
  }
}
