:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e4e6eb;
  --text: #16181d;
  --text-soft: #6b7280;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --amber-bg: #fef3c7; --amber-fg: #92400e;
  --green-bg: #dcfce7; --green-fg: #166534;
  --red-bg: #fee2e2; --red-fg: #991b1b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1 { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }

/* ---- topbar ---- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 24px;
  height: 60px; display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { font-size: 24px; }
.brand-name { display: block; font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-sub { display: block; font-size: 12px; color: var(--text-soft); line-height: 1.2; }
.topnav { display: flex; align-items: center; gap: 18px; }
.nav-link { font-size: 14px; color: var(--text-soft); }
.nav-link:hover { color: var(--text); }
.nav-user { font-size: 14px; font-weight: 600; }
.nav-logout { color: var(--accent); }

.container { max-width: 1080px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head { margin-bottom: 20px; }

/* ---- filters ---- */
.filters { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pill {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  padding: 7px 14px; border-radius: 999px; font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; font-family: inherit;
  transition: border-color .15s, color .15s;
}
.pill:hover { border-color: #c7cad1; color: var(--text); }
.pill-active { background: var(--text); border-color: var(--text); color: #fff; }
.pill-active:hover { color: #fff; }
.pill-count {
  font-size: 12px; font-weight: 600; background: rgba(0,0,0,.06);
  padding: 1px 7px; border-radius: 999px;
}
.pill-active .pill-count { background: rgba(255,255,255,.22); }

.filter-controls { display: flex; gap: 10px; }
.filter-controls select, .filter-controls input[type="search"] {
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  padding: 9px 12px; font-size: 14px; font-family: inherit; color: var(--text);
}
.filter-controls input[type="search"] { flex: 1; min-width: 0; }
.filter-controls select:focus, .filter-controls input:focus,
textarea:focus, .login-card input:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
}

/* ---- list rows ---- */
.rows {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.row {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.row:last-child { border-bottom: none; }
.row:hover { background: #fafbfc; }
.row-main { min-width: 0; }
.row-title {
  font-weight: 600; margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-meta { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-soft); flex-wrap: wrap; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.row-created { font-size: 12px; color: var(--text-soft); }

/* ---- badges ---- */
.badge {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.badge-kind { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.badge-pending { background: var(--amber-bg); color: var(--amber-fg); }
.badge-approved { background: var(--green-bg); color: var(--green-fg); }
.badge-rejected { background: var(--red-bg); color: var(--red-fg); }
.badge-lg { font-size: 13px; padding: 5px 14px; }

/* ---- empty state ---- */
.empty { text-align: center; padding: 70px 0; color: var(--text-soft); }
.empty-icon { font-size: 40px; margin-bottom: 8px; }

/* ---- detail ---- */
.back { display: inline-block; font-size: 14px; color: var(--text-soft); margin-bottom: 14px; }
.back:hover { color: var(--text); }
.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.detail-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
.meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px 20px; }
.meta-item { font-size: 14px; }
.meta-label { display: block; font-size: 12px; color: var(--text-soft); margin-bottom: 2px; }
.description {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border);
  white-space: pre-wrap; overflow-wrap: break-word;
}

/* ---- files ---- */
.files { display: flex; flex-direction: column; gap: 8px; }
.file {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px;
  transition: border-color .15s, background .15s;
}
.file:hover { border-color: var(--accent); background: var(--accent-soft); }
.file-icon { font-size: 18px; }
.file-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { margin-left: auto; font-size: 12px; color: var(--text-soft); flex-shrink: 0; }

/* ---- review panel ---- */
.review-card { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 80px; }
.review-card textarea {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-family: inherit; font-size: 14px; resize: vertical; color: var(--text);
}

/* ---- buttons ---- */
.btn {
  border: none; border-radius: 10px; padding: 10px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: filter .15s;
}
.btn:hover { filter: brightness(.95); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-approve { background: #16a34a; color: #fff; }
.btn-reject { background: #dc2626; color: #fff; }
.btn-neutral { background: var(--bg); color: var(--text-soft); border: 1px solid var(--border); }
.btn-block { width: 100%; }

/* ---- login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 4px 24px rgba(16, 24, 40, .06);
  width: 100%; max-width: 360px; padding: 36px 32px;
  display: flex; flex-direction: column; gap: 14px; text-align: center;
}
.login-logo { font-size: 40px; }
.login-card h1 { font-size: 20px; }
.login-sub { margin: -10px 0 6px; font-size: 13px; color: var(--text-soft); }
.login-error {
  background: var(--red-bg); color: var(--red-fg);
  border-radius: 10px; padding: 9px 12px; font-size: 13px;
}
.login-card label { text-align: left; font-size: 13px; color: var(--text-soft); display: flex; flex-direction: column; gap: 5px; }
.login-card input {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-size: 15px; font-family: inherit; color: var(--text);
}

/* ---- responsive ---- */
@media (max-width: 800px) {
  .detail-grid { grid-template-columns: 1fr; }
  .review-card { position: static; }
  .row-side { align-items: flex-start; }
  .row { flex-direction: column; align-items: stretch; gap: 8px; }
  .brand-sub { display: none; }
}
