/* assets/css/app.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #f5f4f0;
  --surface:     #ffffff;
  --surface2:    #f0efe9;
  --border:      #e2e0d8;
  --border-md:   #ccc9be;
  --text:        #1a1916;
  --text2:       #6b6860;
  --text3:       #9b9890;
  --accent:      #1a4f8a;
  --accent-lt:   #e8eef7;
  --success:     #166534;
  --success-bg:  #dcfce7;
  --warning:     #854d0e;
  --warning-bg:  #fef9c3;
  --danger:      #991b1b;
  --danger-bg:   #fee2e2;
  --info:        #1e40af;
  --info-bg:     #dbeafe;
  --purple:      #7c3aed;
  --purple-bg:   #ede9fe;
  --sidebar-w:   220px;
  --topbar-h:    52px;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 1px 3px rgba(0,0,0,.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,.10);
}

body { font-family: 'Segoe UI', system-ui, sans-serif; color: var(--text); font-size: 14px; line-height: 1.5;}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 200;
  box-shadow: var(--shadow);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px; border-bottom: 1px solid var(--border);
}
.logo-mark {
  width: 34px; height: 34px; background: var(--accent);
  border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.logo-title { font-size: 14px; font-weight: 700; color: var(--text); }
.logo-sub   { font-size: 11px; color: var(--text3); }

.nav-list { list-style: none; padding: 10px 8px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text2); text-decoration: none; font-size: 10px; font-weight: 500;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
}
.nav-item:hover  { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-lt); color: var(--accent); font-weight: 600; }

.sidebar-footer {
  padding: 12px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0; text-transform: uppercase;
}
.user-name  { font-size: 13px; font-weight: 600; color: var(--text); }
.user-role  { font-size: 11px; font-weight: 500; }
.user-detail { flex: 1; min-width: 0; }
.user-detail .user-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn-logout {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: var(--danger-bg); color: var(--danger);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; font-size: 16px; flex-shrink: 0;
  transition: background .15s;
}
.btn-logout:hover { background: var(--danger); color: white; }

/* ── Main wrap ───────────────────────────────────────────── */
.main-wrap { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 1.5rem; position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.sidebar-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text2); }
.page-title { font-size: 16px; font-weight: 600; color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.role-badge { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 99px; }

.content { padding: 1.75rem; flex: 1; }

/* ── Cards ───────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 1.25rem; flex-wrap: wrap; }
.card-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--accent-lt); display: flex; align-items: center; justify-content: center; font-size: 17px; }
.card-title { font-weight: 600; font-size: 10px; }
.card-subtitle { font-size: 12px; color: var(--text2); }
.card-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Metrics grid ────────────────────────────────────────── */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 12px; margin-bottom: 1.25rem; }
.metric-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.1rem; }
.metric-label { font-size: 10px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.metric-value { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1; }
.metric-sub   { font-size: 10px; color: var(--text3); margin-top: 4px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text2); }
.form-label span { color: var(--danger); }
input, select, textarea {
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  padding: 0 12px; font-size: 14px; font-family: inherit;
  background: var(--surface); color: var(--text); width: 100%;
  transition: border-color .15s;
}
input, select { height: 38px; }
textarea { padding: 10px 12px; resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26,79,138,.1); }
input[type="checkbox"] { width: auto; height: auto; accent-color: var(--accent); }
.form-hint { font-size: 11px; color: var(--text3); margin-top: 3px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  height: 36px; border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  padding: 0 16px; font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); color: var(--text); text-decoration: none;
  transition: all .15s; white-space: nowrap;
}
.btn:hover   { background: var(--surface2); border-color: var(--accent); }
.btn:active  { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: #153f72; border-color: #153f72; color: white; }
.btn-danger  { background: var(--danger-bg); color: var(--danger); border-color: #fca5a5; }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-success { background: var(--success-bg); color: var(--success); border-color: #86efac; }
.btn-success:hover { background: var(--success); color: white; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface2); border-color: var(--border); }

/* ── Table ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 10px; min-width: 500px; }
thead th { background: var(--surface2); padding: 10px 14px; text-align: left; font-size: 9px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--accent-lt); }
.td-num { text-align: right; font-family: 'Courier New', monospace; font-size: 12px; }
.td-actions { display: flex; gap: 6px; }

/* ── Badges ──────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.badge-admin   { background: #dbeafe; color: #1e40af; }
.badge-pm      { background: var(--success-bg); color: var(--success); }
.badge-digital { background: var(--purple-bg); color: var(--purple); }
.badge-active  { background: var(--success-bg); color: var(--success); }
.badge-inactive{ background: var(--surface2); color: var(--text3); border: 1px solid var(--border); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info    { background: var(--info-bg); color: var(--info); }

/* ── Status messages ─────────────────────────────────────── */
.alert { display: flex; align-items: flex-start; gap: 9px; padding: 11px 15px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #86efac; }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid #fca5a5; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #fcd34d; }
.alert-info    { background: var(--info-bg);    color: var(--info);    border: 1px solid #93c5fd; }

/* ── Divider ─────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 1.25rem 0; }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text3); }
.empty-state .empty-icon { font-size: 36px; margin-bottom: 10px; }
.empty-state p { font-size: 13px; }

/* ── Login page ──────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;}
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.5rem 2rem; width: 100%; max-width: 400px; box-shadow: var(--shadow-md); }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 2rem; }
.login-title { font-size: 20px; font-weight: 700; }
.login-sub   { font-size: 13px; color: var(--text2); }

/* ── Section header ──────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: 8px; }
.section-title  { font-size: 15px; font-weight: 600; }

/* ── Tab nav ─────────────────────────────────────────────── */
.tab-nav { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab-item { padding: 10px 18px; font-size: 13px; font-weight: 500; color: var(--text2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; transition: color .15s; white-space: nowrap; }
.tab-item:hover  { color: var(--text); }
.tab-item.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .main-wrap::before { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 199; }
  .main-wrap { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
}
