/* Extracted verbatim from admin.html. No visual behavior intentionally changed. */

:root{
  --gold:#C9A227; --gold-dark:#A9861D; --gold-tint:#F4E9CB;
  --maroon:#7A2020; --maroon-dark:#5E1818; --maroon-tint:#F3E2E0;
  --bg:#FAF7F0; --surface:#FBF4E6; --surface-2:#F3ECDC;
  --green:#7EA945; --green-tint:#E7EFDA;
  --red:#B3452E; --red-tint:#F5E3DE;
  --text:#2E2820; --text-muted:#7A7060; --text-faint:#A69C8C;
  --border:#E7DDC9; --border-strong:#D8CBAE; --white:#FFFFFF;
  --r-sm:8px; --r-md:12px; --r-btn:14px; --r-input:12px; --r-card:16px; --r-modal:20px;
  --shadow-1:0 1px 2px rgba(46,40,32,.04), 0 1px 1px rgba(46,40,32,.03);
  --shadow-2:0 8px 24px rgba(46,40,32,.10);
  --ease-out:cubic-bezier(.16,1,.3,1);
  --font:'Plus Jakarta Sans','Inter',-apple-system,BlinkMacSystemFont,sans-serif;
}
*,*::before,*::after{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
body{ margin:0; font-family:var(--font); background:var(--bg); color:var(--text); line-height:1.5; -webkit-font-smoothing:antialiased; }
img{ max-width:100%; display:block; }
button{ font-family:inherit; cursor:pointer; }
input,textarea,select{ font-family:inherit; font-size:14px; }
h1,h2,h3{ margin:0; }
a{ color:inherit; }

/* ---------- layout ---------- */
.app{ display:flex; min-height:100vh; }
.sidebar{ width:230px; flex-shrink:0; background:var(--maroon); color:#fff; padding:24px 16px; display:flex; flex-direction:column; gap:4px; position:sticky; top:0; height:100vh; }
.sidebar-brand{ font-weight:800; font-size:16px; margin-bottom:24px; padding:0 12px; line-height:1.3; }
.sidebar-brand span{ display:block; font-weight:500; font-size:11px; opacity:.7; text-transform:uppercase; letter-spacing:.04em; margin-top:2px; }
.nav-item{ display:flex; align-items:center; gap:10px; padding:11px 12px; border-radius:var(--r-btn); color:rgba(255,255,255,.75); background:none; border:none; text-align:left; font-size:14px; font-weight:600; width:100%; }
.nav-item:hover{ background:rgba(255,255,255,.08); color:#fff; }
.nav-item.is-active{ background:rgba(255,255,255,.16); color:#fff; }
.sidebar-foot{ margin-top:auto; padding-top:16px; border-top:1px solid rgba(255,255,255,.15); }
.main{ flex:1; padding:32px 40px; max-width:1100px; }
.topbar{ display:flex; align-items:center; justify-content:space-between; margin-bottom:24px; flex-wrap:wrap; gap:12px; }
.page-title{ font-size:22px; font-weight:800; }
.page-sub{ color:var(--text-muted); font-size:13.5px; margin-top:2px; }

/* ---------- buttons ---------- */
.btn{ display:inline-flex; align-items:center; gap:8px; padding:10px 18px; border-radius:var(--r-btn); border:1.5px solid transparent; font-weight:700; font-size:13.5px; transition:.15s var(--ease-out); }
.btn-primary{ background:var(--maroon); color:#fff; }
.btn-primary:hover{ background:var(--maroon-dark); }
.btn-secondary{ background:var(--white); color:var(--text); border-color:var(--border-strong); }
.btn-secondary:hover{ border-color:var(--maroon); }
.btn-ghost{ background:none; color:var(--text-muted); border:none; padding:8px 10px; }
.btn-ghost:hover{ color:var(--text); }
.btn-danger{ background:var(--red-tint); color:var(--red); }
.btn-danger:hover{ background:#efc9bb; }
.btn-sm{ padding:7px 12px; font-size:12.5px; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }

/* ---------- card / table ---------- */
.card{ background:var(--white); border:1px solid var(--border); border-radius:var(--r-card); box-shadow:var(--shadow-1); }
.table-wrap{ overflow-x:auto; }
table{ width:100%; border-collapse:collapse; font-size:13.5px; }
th{ text-align:left; padding:12px 16px; background:var(--surface-2); color:var(--text-muted); font-weight:700; font-size:12px; text-transform:uppercase; letter-spacing:.03em; white-space:nowrap; }
td{ padding:12px 16px; border-top:1px solid var(--border); vertical-align:middle; }
tr:hover td{ background:var(--surface); }
.thumb{ width:42px; height:42px; border-radius:var(--r-sm); object-fit:cover; background:var(--surface-2); flex-shrink:0; }
.cell-name{ font-weight:700; }
.cell-flex{ display:flex; align-items:center; gap:10px; }
.badge{ display:inline-block; padding:3px 10px; border-radius:99px; font-size:11px; font-weight:700; }
.badge-on{ background:var(--green-tint); color:#4A6B22; }
.badge-off{ background:var(--surface-2); color:var(--text-faint); }
.badge-gold{ background:var(--gold-tint); color:var(--gold-dark); }
.row-actions{ display:flex; gap:6px; justify-content:flex-end; }
.empty{ padding:48px 16px; text-align:center; color:var(--text-muted); }

/* ---------- form ---------- */
.field{ margin-bottom:16px; }
.field-password-wrap{ position:relative; }
.field-password-wrap input{ padding-right:44px !important; }
.field-password-toggle{
  position:absolute; right:4px; top:50%; transform:translateY(-50%);
  width:36px; height:36px; display:flex; align-items:center; justify-content:center;
  background:transparent; border:none; border-radius:var(--r-sm); color:var(--text-faint); padding:0;
}
.field-password-toggle:hover{ background:var(--surface-2); color:var(--text); }
.field-password-toggle:focus-visible{ outline:2px solid var(--maroon); outline-offset:2px; }
.field-password-toggle svg{ width:20px; height:20px; }
.field label{ display:block; font-weight:700; font-size:13px; margin-bottom:6px; }
.field .hint{ font-weight:400; color:var(--text-faint); font-size:12px; }
.field input[type=text], .field input[type=number], .field input[type=email], .field input[type=password], .field input[type=date], .field textarea, .field select{
  width:100%; padding:10px 12px; border:1.5px solid var(--border-strong); border-radius:var(--r-input); background:var(--white); color:var(--text);
}
.field textarea{ resize:vertical; min-height:90px; }
.field input:focus, .field textarea:focus, .field select:focus{ outline:none; border-color:var(--maroon); }
.checkrow{ display:flex; align-items:center; gap:8px; font-weight:600; font-size:13.5px; }
.form-grid{ display:grid; grid-template-columns:1fr 1fr; gap:0 16px; }
.form-grid .field.full{ grid-column:1/-1; }
.spec-row{ display:flex; gap:8px; margin-bottom:8px; }
.spec-row input{ flex:1; }
.repeat-row{ display:flex; gap:8px; margin-bottom:8px; align-items:flex-start; }
.repeat-row textarea, .repeat-row input{ flex:1; }
.repeat-row textarea{ min-height:44px; }
.timeline-row{ border:1.5px solid var(--border); border-radius:var(--r-sm); padding:12px; margin-bottom:10px; }
.timeline-row .field{ margin-bottom:10px; }
.timeline-row .field:last-of-type{ margin-bottom:0; }
.timeline-row-head{ display:flex; justify-content:flex-end; margin-bottom:-4px; }
.upload-box{ display:flex; align-items:center; gap:14px; }
.upload-preview{ width:64px; height:64px; border-radius:var(--r-sm); object-fit:cover; background:var(--surface-2); border:1px solid var(--border); }

/* ---------- modal ---------- */
.overlay{ position:fixed; inset:0; background:rgba(46,40,32,.45); display:flex; align-items:flex-start; justify-content:center; padding:40px 16px; overflow-y:auto; z-index:50; }
.modal{ background:var(--white); border-radius:var(--r-modal); width:100%; max-width:560px; padding:28px; box-shadow:var(--shadow-2); }
.modal-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; }
.modal-head h3{ font-size:17px; font-weight:800; }

/* ---------- login ---------- */
.login-wrap{ min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px; }
.login-card{ width:100%; max-width:380px; background:var(--white); border:1px solid var(--border); border-radius:var(--r-card); box-shadow:var(--shadow-2); padding:32px; }
.login-card h1{ font-size:19px; font-weight:800; margin-bottom:2px; }
.login-card p{ color:var(--text-muted); font-size:13.5px; margin:0 0 20px; }
.login-error{ background:var(--red-tint); color:var(--red); padding:10px 14px; border-radius:var(--r-sm); font-size:13px; margin-bottom:14px; }

/* ---------- toast ---------- */
.toast{ position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(20px); background:var(--text); color:#fff; padding:12px 20px; border-radius:99px; font-size:13.5px; font-weight:600; opacity:0; transition:.25s var(--ease-out); pointer-events:none; z-index:100; }
.toast.is-show{ opacity:1; transform:translateX(-50%) translateY(0); }

.hidden{ display:none !important; }
.spin{ width:16px; height:16px; border:2px solid rgba(255,255,255,.4); border-top-color:#fff; border-radius:50%; animation:spin .7s linear infinite; }
@keyframes spin{ to{ transform:rotate(360deg); } }

/* ---------- mobile topbar + drawer ---------- */
.mobile-topbar{ display:none; }
.sidebar-overlay{ display:none; }
@media(max-width:800px){
  .app{ flex-direction:column; }

  .mobile-topbar{
    display:flex; align-items:center; gap:12px;
    position:sticky; top:0; z-index:40;
    background:var(--maroon); color:#fff;
    padding:calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  }
  .mobile-topbar .brand{ font-weight:800; font-size:15px; }
  .hamburger-btn{
    display:flex; align-items:center; justify-content:center;
    width:36px; height:36px; flex-shrink:0;
    background:rgba(255,255,255,.12); border:none; border-radius:var(--r-sm); color:#fff; padding:0;
  }
  .hamburger-btn svg{ width:20px; height:20px; }

  .sidebar{
    position:fixed; top:0; left:0; height:100vh; width:250px;
    flex-direction:column; overflow-x:visible; overflow-y:auto;
    padding:calc(env(safe-area-inset-top, 0px) + 20px) 16px 20px;
    transform:translateX(-100%); transition:transform .22s var(--ease-out);
    z-index:60; box-shadow:var(--shadow-2);
  }
  .sidebar.is-open{ transform:translateX(0); }
  .sidebar-brand, .sidebar-foot{ display:flex; flex-direction:column; gap:4px; }
  .sidebar-brand{ display:block; }

  .sidebar-overlay{
    display:block; position:fixed; inset:0; background:rgba(46,40,32,.45);
    z-index:55; opacity:0; pointer-events:none; transition:opacity .2s var(--ease-out);
  }
  .sidebar-overlay.is-open{ opacity:1; pointer-events:auto; }

  .main{ padding:20px 16px; }
  .form-grid{ grid-template-columns:1fr; }
}


/* ---------- certificate management ---------- */
.cert-admin-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px;flex-wrap:wrap;}
.cert-admin-search{flex:1;min-width:220px;padding:10px 12px;border:1.5px solid var(--border-strong);border-radius:var(--r-input);background:var(--white);color:var(--text);font:inherit;}
.cert-admin-search:focus{outline:none;border-color:var(--maroon);}
@media(max-width:700px){.cert-admin-toolbar{align-items:stretch}.cert-admin-search{min-width:100%}.cert-admin-toolbar .btn{width:100%;justify-content:center}}
