/* FINAL styled dashboard (sans serif regular) */
:root{
  --bg:#f7f8fb;
  --panel:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e5e7eb;
  --shadow: 0 10px 26px rgba(15,23,42,.07);
  --danger:#b91c1c;
  --dangerBg:#fff1f2;
  --dangerBorder:#fecdd3;
}
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
}
code{ background:#eef2ff; padding:2px 6px; border-radius:8px; }
.label{ display:block; font-size: 13px; color: var(--muted); margin: 0 0 6px 0; }
.input, .select{
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
.input:focus, .select:focus{
  border-color: rgba(37,99,235,.55);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}
.btn{
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  cursor:pointer;
}
.btn:hover{ border-color:#cbd5e1; }
.btnPrimary{
  border-color: rgba(37,99,235,.25);
  background: linear-gradient(180deg, rgba(37,99,235,.12), rgba(14,165,233,.10));
}
.btnGhost{
  text-decoration:none;
  color: var(--text);
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.iconBtn{
  border:1px solid var(--border);
  background:#fff;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display:grid;
  place-items:center;
  cursor:pointer;
  font-size: 14px;
}

/* Login */
.loginWrap{ min-height:100vh; display:grid; place-items:center; padding: 24px; }
.loginCard{
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.brand{ display:flex; gap:12px; align-items:center; margin-bottom: 14px; }
.logo{ font-size: 28px; width: 44px; height: 44px; display:grid; place-items:center; background:#eff6ff; border-radius:14px; }
.brandTitle{ font-size: 18px; letter-spacing: .2px; }
.brandSub{ font-size: 13px; color: var(--muted); margin-top: 2px; }
.alert{
  background: var(--dangerBg);
  border:1px solid var(--dangerBorder);
  color: var(--danger);
  padding:10px 12px;
  border-radius:12px;
  margin: 10px 0 12px 0;
  font-size: 14px;
}
.hint{ margin-top: 12px; color: var(--muted); font-size: 13px; }
.loginForm{ display:grid; gap: 10px; }

/* Top bar */
.topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247,248,251,.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
}
.topbarLeft{ display:flex; gap:10px; align-items:center; }
.appTitle{ font-size: 16px; letter-spacing: .2px; }
.pill{
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
}
.topbarControls{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap: wrap;
  justify-content:flex-end;
}

/* Page content */
.page{ padding: 16px; }
.content{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 14px;
}
.contentFull{ width: 100%; }

.contentToolbar{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.searchWrap{ position: relative; display:flex; align-items:center; }
.searchWrapWide{ flex: 1 1 auto; min-width: 280px; }
.inputSearch{ padding-right: 54px; }
.inputSearch.wide{
  width: min(1100px, 72vw);
  height: 46px;
  padding: 12px 56px 12px 14px;
  font-size: 15px;
}
#clearQ{
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 12px;
}
.toolbarRight{
  display:flex;
  align-items:center;
  gap: 14px;
  justify-content:flex-end;
  white-space: nowrap;
}
.contentMeta{ font-size: 13px; color: var(--muted); }
.toggle{ font-size: 13px; color: var(--muted); display:flex; gap: 8px; align-items:center; user-select:none; }
.toggle.tight{ gap: 6px; }

.contentSubbar{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 12px;
  padding-top: 10px;
  padding-bottom: 12px;
}
.chips{ display:flex; flex-wrap:wrap; gap:8px; }
.chip{
  border:1px solid var(--border);
  background:#fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  cursor:pointer;
}
.chip.active{
  border-color: rgba(14,165,233,.55);
  box-shadow: 0 0 0 4px rgba(14,165,233,.10);
}

.errorBox{
  background: var(--dangerBg);
  border:1px solid var(--dangerBorder);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 14px;
  margin: 10px 0 12px 0;
  font-size: 13px;
}

.tableWrap{
  width: 100%;
  overflow:auto;
  border: 1px solid var(--border);
  border-radius: 16px;
}
.table{
  width:100%;
  border-collapse: collapse;
  background:#fff;
  min-width: 880px;
}
.table thead th{
  text-align:left;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.table.compact thead th{ padding: 11px 12px; }
.table tbody td{
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 14px;
}
.fileCell{ display:flex; gap: 10px; align-items:center; }
.icon{
  width: 30px; height: 30px;
  border-radius: 10px;
  background: #f1f5f9;
  display:grid;
  place-items:center;
  font-size: 14px;
  flex: 0 0 auto;
}
.fileName{ line-height: 1.25; }

.fileLink{
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  color: #0f172a;
  cursor: pointer;
  text-align: left;
}
.fileLink:hover{ text-decoration: underline; }

.filePath{ margin-top: 3px; font-size: 12px; color: var(--muted); word-break: break-word; display:none; }
.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  border:1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--muted);
  background:#fff;
}

.actions{ display:flex; gap: 10px; align-items:center; flex-wrap: nowrap; }
.smallBtn{
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: #fff;
  cursor:pointer;
  text-decoration:none;
  color: var(--text);
  display:inline-flex;
  align-items:center;
  gap: 6px;
  line-height: 1;
}
.smallBtn.primary{
  border-color: rgba(37,99,235,.25);
  background: linear-gradient(180deg, rgba(37,99,235,.10), rgba(14,165,233,.08));
}
.smallBtn[disabled]{ opacity: .55; cursor:not-allowed; }
.empty{ padding: 18px 14px; color: var(--muted); text-align:center; }

/* Modal */
.modal{ position: fixed; inset: 0; display:none; z-index: 50; }
.modal.show{ display:block; }
.modalBackdrop{ position:absolute; inset:0; background: rgba(15,23,42,.45); }
.modalCard{
  position: relative;
  width: min(1100px, calc(100% - 24px));
  height: min(82vh, 760px);
  margin: 5vh auto 0 auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 22px 60px rgba(0,0,0,.28);
  overflow:hidden;
}
.modalHeader{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.modalTitle{ font-size: 14px; white-space: nowrap; overflow:hidden; text-overflow: ellipsis; }
.modalActions{ display:flex; gap: 8px; align-items:center; }
.modalBody{ height: calc(100% - 52px); background: #fff; }
.modalBody iframe{ width:100%; height:100%; border:0; display:block; }

@media (max-width: 980px){
  .toolbarRight{ flex-wrap: wrap; justify-content:flex-start; }
  .inputSearch.wide{ width: 100%; min-width: 220px; }
  .contentToolbar{ flex-wrap: wrap; justify-content:flex-start; }
  .contentSubbar{ flex-wrap: wrap; justify-content:flex-start; }
}
