/* TDocs — soft, light, modern, responsive */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1e2433;
  --muted: #6b7386;
  --border: #e4e8f2;
  --primary: #3b6fe0;
  --primary-dark: #2f5bc4;
  --primary-soft: #e9effc;
  --green: #2ea043;
  --red: #e5484d;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(30, 36, 51, 0.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.3px; }
h2 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); }
.empty { padding: 24px; text-align: center; }

/* topbar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 10px 20px; position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, #3b6fe0, #7a5af8);
  color: #fff; font-weight: 800; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-mark-lg { width: 48px; height: 48px; font-size: 26px; border-radius: 13px; }
.brand-name { font-weight: 700; font-size: 17px; }
.topnav { display: flex; gap: 4px; }
.topnav a { color: var(--muted); padding: 8px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; }
.topnav a:hover { text-decoration: none; background: var(--primary-soft); color: var(--primary); }
.topnav a.active { background: var(--primary-soft); color: var(--primary); }
.logout-form { margin-left: auto; }

/* layout */
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 20px; flex: 1; }
.footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 18px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 0; font-size: 13.5px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* cards */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }

/* stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { margin: 0; text-align: left; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.4px; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8faff; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 12px; font-weight: 700;
}

/* forms */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.field input[type="text"], .field input[type="password"], .field input[type="search"],
.field input[type="file"], .field select, .field textarea,
.filter-row input, .filter-row select {
  width: 100%; padding: 10px 12px; font-size: 14px; color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; background: #fbfcff;
}
.field input:focus, .field select:focus, .field textarea:focus,
.filter-row input:focus, .filter-row select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.field textarea { resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0; }
.filter-row input[type="search"] { flex: 2; min-width: 180px; }
.filter-row select, .filter-row input[type="text"] { flex: 1; min-width: 140px; }
.form-card { max-width: 620px; }

/* buttons */
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 10px;
  border: 1px solid transparent; font-size: 14px; font-weight: 700;
  cursor: pointer; text-align: center;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--card); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fdecec; color: var(--red); border-color: #f5c2c4; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* flashes */
.flashes { margin-bottom: 14px; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 8px; font-size: 14px; }
.flash-success { background: #e6f6ea; color: #1c7a33; border: 1px solid #bfe6c9; }
.flash-error { background: #fdecec; color: #b4232a; border: 1px solid #f5c2c4; }

/* login */
.login-wrap { display: flex; justify-content: center; padding: 48px 16px; }
.login-card { max-width: 380px; width: 100%; text-align: center; }
.login-brand { margin-bottom: 8px; }
.login-card h1 { margin-bottom: 2px; }
.login-card form { text-align: left; margin-top: 16px; }

/* detail */
.detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.detail-list { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; margin: 0 0 16px; font-size: 14px; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; word-break: break-word; }
.preview-img { max-width: 100%; border-radius: 10px; border: 1px solid var(--border); }
.preview-pdf { width: 100%; height: 560px; border: 1px solid var(--border); border-radius: 10px; }
.empty-card { text-align: center; padding: 48px 24px; }

@media (max-width: 720px) {
  .container { padding: 14px; }
  .detail-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .preview-pdf { height: 420px; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .brand-name { display: none; }
  .page-head { flex-direction: column; align-items: stretch; }
}
