/* =============================================================
   Lauritz Knudsen — AID Partner Portal
   File: assets/css/style.css
   Shared stylesheet for all pages.
   Brand colours are defined once in :root — change them here only.
   ============================================================= */

/* ---------- 1. DESIGN TOKENS ---------- */
:root{
  --navy:#175D8D;            /* Lauritz Knudsen logo blue */
  --navy-2:#1E6FA6;
  --navy-dark:#11486E;
  --ink:#1B2430;
  --muted:#5B6B7F;
  --line:#DCE3EC;
  --bg:#F3F6FA;
  --card:#FFFFFF;
  --accent:#E8262B;
  --accent-dark:#C21C21;
  --spark:#FFB800;
  --ok:#0F9D58;
  --ok-bg:#E7F6EE;
  --warn:#B7791F;
  --warn-bg:#FDF3E2;

  --radius:14px;
  --shadow:0 6px 24px rgba(23,93,141,.10);
  --font-display:'Archivo', Arial, sans-serif;
  --font-body:'Inter', Arial, sans-serif;

  --sidebar-w:250px;
  --topbar-h:60px;
}

/* ---------- 2. BASE / RESET ---------- */
*{margin:0;padding:0;box-sizing:border-box}
html{font-size:16px;-webkit-text-size-adjust:100%}
body{
  font-family:var(--font-body);
  background:var(--bg);
  color:var(--ink);
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
img,svg{max-width:100%;display:block}
button{font-family:inherit;cursor:pointer}
input,select,textarea{font-family:inherit;font-size:1rem}
a{color:var(--navy)}

/* ---------- 3. FORM ELEMENTS ---------- */
.field{margin-bottom:18px;min-width:0}
.field label{display:block;font-size:.85rem;font-weight:600;margin-bottom:6px}
.field .req{color:var(--accent)}
.field input,
.field select,
.field textarea{
  width:100%;
  padding:12px 14px;
  border:1.5px solid var(--line);
  border-radius:10px;
  background:#fff;
  color:var(--ink);
  transition:border-color .15s, box-shadow .15s;
}
.field textarea{resize:vertical;min-height:88px}
.field input:focus,
.field select:focus,
.field textarea:focus{
  outline:none;
  border-color:var(--navy);
  box-shadow:0 0 0 3px rgba(23,93,141,.15);
}
.field .hint{font-size:.78rem;color:var(--muted);margin-top:5px}
.field .err{display:none;font-size:.78rem;color:var(--accent);margin-top:5px}
.field.invalid input,
.field.invalid select,
.field.invalid textarea{border-color:var(--accent)}
.field.invalid .err{display:block}

/* ---------- 4. BUTTONS ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:13px 22px;border-radius:10px;border:none;
  font-weight:600;font-size:.95rem;min-height:48px;
  transition:background .15s, transform .1s, border-color .15s;
  text-decoration:none;
}
.btn:active{transform:scale(.985)}
.btn:focus-visible{outline:3px solid var(--spark);outline-offset:2px}
.btn-primary{background:var(--accent);color:#fff}
.btn-primary:hover{background:var(--accent-dark)}
.btn-navy{background:var(--navy);color:#fff}
.btn-navy:hover{background:var(--navy-2)}
.btn-ghost{background:#fff;color:var(--navy);border:1.5px solid var(--line)}
.btn-ghost:hover{border-color:var(--navy)}
.btn-block{width:100%}

/* ---------- 5. LOGO ---------- */
.lk-logo{height:auto}

/* ---------- 6. LOGIN PAGE ---------- */
.login-wrap{min-height:100vh;display:grid;grid-template-columns:1.05fr 1fr}
.login-left{
  background:linear-gradient(160deg,var(--navy) 0%,var(--navy-dark) 100%);
  color:#fff;display:flex;flex-direction:column;justify-content:space-between;
  padding:48px;position:relative;overflow:hidden;
}
.login-left > *{position:relative;z-index:1}
.login-left::after{           /* decorative circuit motif */
  content:"";position:absolute;right:-70px;bottom:-70px;width:420px;height:420px;z-index:0;
  background:
    linear-gradient(#ffffff14,#ffffff14) 0 60px/300px 2px no-repeat,
    linear-gradient(#ffffff14,#ffffff14) 60px 0/2px 300px no-repeat,
    radial-gradient(circle 6px at 60px 60px,#FFB800 98%,transparent),
    radial-gradient(circle 6px at 200px 60px,#ffffff33 98%,transparent),
    radial-gradient(circle 6px at 60px 200px,#ffffff33 98%,transparent);
  transform:rotate(-8deg);
}
.login-hero h1{
  font-family:var(--font-display);font-weight:800;
  font-size:clamp(1.7rem,3.2vw,2.6rem);line-height:1.15;max-width:520px;
}
.login-hero p{margin-top:14px;max-width:460px;opacity:.88}
.login-foot{font-size:.8rem;opacity:.65}
.login-right{display:grid;place-items:center;padding:40px 24px;background:var(--card)}
.login-card{width:100%;max-width:400px}
.login-card h2{font-family:var(--font-display);font-weight:700;font-size:1.5rem}
.login-card .sub{color:var(--muted);margin:6px 0 26px;font-size:.95rem}
.login-links{display:flex;justify-content:space-between;gap:12px;margin-top:16px;font-size:.85rem;flex-wrap:wrap}
.login-links a{font-weight:600;text-decoration:none}
.login-links a:hover{text-decoration:underline}

/* ---------- 7. APP SHELL + SIDEBAR ---------- */
.shell{min-height:100vh}

/* mobile top bar — hidden on desktop */
.mobile-bar{
  display:none;align-items:center;gap:12px;
  height:var(--topbar-h);padding:0 14px;
  background:var(--navy);color:#fff;
  position:sticky;top:0;z-index:40;
}
.hamburger{
  width:42px;height:42px;flex:none;border:none;border-radius:10px;
  background:#ffffff1f;color:#fff;display:grid;place-items:center;
}
.hamburger:hover{background:#ffffff33}
.mobile-bar .m-title{font-family:var(--font-display);font-weight:700;font-size:1rem}

.sidebar{
  width:var(--sidebar-w);background:var(--navy);color:#fff;
  padding:22px 16px;display:flex;flex-direction:column;
  position:fixed;top:0;left:0;height:100vh;z-index:60;overflow-y:auto;
}
.sidebar .brand{margin-bottom:30px;padding:0 4px}
.sidebar-close{display:none;position:absolute;top:14px;right:14px;
  width:38px;height:38px;border:none;border-radius:10px;background:#ffffff1f;color:#fff}

.nav-item{
  display:flex;align-items:center;gap:12px;
  padding:12px 14px;border-radius:10px;
  color:#CDDDEA;font-weight:500;font-size:.93rem;
  border:none;background:transparent;width:100%;text-align:left;
  margin-bottom:4px;text-decoration:none;min-height:46px;
}
.nav-item svg{flex:none}
.nav-item:hover{background:#ffffff1a;color:#fff}
.nav-item.active{background:var(--accent);color:#fff}
.sidebar .spacer{flex:1;min-height:20px}
.user-chip{display:flex;align-items:center;gap:10px;padding:14px 8px;border-top:1px solid #ffffff2b}
.avatar{
  width:38px;height:38px;flex:none;border-radius:50%;
  background:var(--spark);color:var(--navy-dark);
  display:grid;place-items:center;font-weight:700;font-family:var(--font-display);
}
.user-chip .who{font-size:.85rem;line-height:1.3;min-width:0}
.user-chip .who strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.user-chip .who small{color:#B9CDDD;display:block;font-size:.72rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.sidebar-backdrop{
  display:none;position:fixed;inset:0;background:rgba(17,72,110,.55);z-index:50;
}
.sidebar-backdrop.show{display:block}

.main{
  margin-left:var(--sidebar-w);
  padding:28px 34px;max-width:1120px;
}

/* ---------- 8. PAGE HEADER ---------- */
.topbar{
  display:flex;align-items:flex-start;justify-content:space-between;
  gap:16px;margin-bottom:26px;flex-wrap:wrap;
}
.topbar h1{font-family:var(--font-display);font-weight:700;font-size:1.55rem;line-height:1.2}
.topbar .crumb{color:var(--muted);font-size:.85rem;margin-top:4px}

/* ---------- 9. CARDS / PANELS ---------- */
.stat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:16px;margin-bottom:26px}
.stat{
  background:var(--card);border-radius:var(--radius);box-shadow:var(--shadow);
  padding:20px;border-top:4px solid var(--navy);
}
.stat.alt{border-top-color:var(--accent)}
.stat.alt2{border-top-color:var(--spark)}
.stat .num{font-family:var(--font-display);font-weight:800;font-size:2rem;line-height:1.1}
.stat .lbl{color:var(--muted);font-size:.85rem;margin-top:4px}

.panel{background:var(--card);border-radius:var(--radius);box-shadow:var(--shadow);padding:26px}
.panel h2{font-family:var(--font-display);font-weight:700;font-size:1.15rem;margin-bottom:6px}
.panel .sub{color:var(--muted);font-size:.9rem;margin-bottom:20px}

/* ---------- 10. STEPPER ---------- */
.stepper{display:flex;align-items:center;gap:10px;margin-bottom:24px;flex-wrap:wrap}
.step{display:flex;align-items:center;gap:8px;font-size:.85rem;color:var(--muted)}
.step .dot{
  width:26px;height:26px;flex:none;border-radius:50%;border:2px solid var(--line);
  display:grid;place-items:center;font-weight:700;font-size:.75rem;background:#fff;
}
.step.done .dot{background:var(--ok);border-color:var(--ok);color:#fff}
.step.now .dot{border-color:var(--accent);color:var(--accent)}
.step.now{color:var(--ink);font-weight:600}
.step-bar{width:32px;height:2px;background:var(--line);flex:none}

/* ---------- 11. FORM LAYOUT ---------- */
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 22px}
.form-grid .full{grid-column:1 / -1}
.form-actions{display:flex;gap:12px;justify-content:flex-end;margin-top:8px;flex-wrap:wrap}

/* ---------- 12. CREDENTIALS / SHARE ---------- */
.success-head{display:flex;flex-direction:column;align-items:center;text-align:center;margin-bottom:24px}
.tick{width:64px;height:64px;border-radius:50%;background:var(--ok-bg);display:grid;place-items:center;margin-bottom:14px}
.cred-card{
  border:1.5px dashed var(--navy);border-radius:var(--radius);
  padding:20px;margin-bottom:20px;background:linear-gradient(180deg,#fff,#F5F9FC);
}
.cred-card h3{font-family:var(--font-display);font-size:1rem;margin-bottom:12px;display:flex;align-items:center;gap:8px}
.cred-row{
  display:flex;justify-content:space-between;align-items:center;gap:12px;
  padding:12px 0;border-bottom:1px solid var(--line);flex-wrap:wrap;
}
.cred-row:last-child{border-bottom:none}
.cred-row .k{color:var(--muted);font-size:.85rem;flex:none}
.cred-row .v{font-weight:600;word-break:break-all;font-size:.9rem;flex:1 1 220px;min-width:0}
.copy-btn{
  border:1px solid var(--line);background:#fff;border-radius:8px;
  padding:8px 12px;font-size:.78rem;font-weight:600;color:var(--navy);min-height:36px;flex:none;
}
.copy-btn:hover{border-color:var(--navy)}
.share-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;margin:6px 0 20px}
.share-btn{
  display:flex;align-items:center;justify-content:center;gap:10px;
  padding:14px;border-radius:10px;border:1.5px solid var(--line);
  background:#fff;font-weight:600;font-size:.9rem;min-height:50px;
}
.share-btn:hover{border-color:var(--navy)}
.share-btn.wa{color:#128C4B}
.share-btn.sms{color:var(--navy)}
.share-btn.em{color:var(--accent)}
.note{background:var(--warn-bg);color:var(--warn);border-radius:10px;padding:12px 14px;font-size:.85rem;margin-bottom:20px}

/* ---------- 13. TABLES ---------- */
.table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
table{width:100%;border-collapse:collapse;font-size:.92rem;min-width:680px}
th{
  font-family:var(--font-display);font-size:.75rem;letter-spacing:.06em;
  text-transform:uppercase;color:var(--muted);text-align:left;
  padding:12px 14px;border-bottom:2px solid var(--line);white-space:nowrap;
}
td{padding:14px;border-bottom:1px solid var(--line);vertical-align:middle}
tr:hover td{background:#F7FAFC}
.pill{display:inline-block;padding:4px 12px;border-radius:99px;font-size:.75rem;font-weight:600;white-space:nowrap}
.pill.invited{background:var(--warn-bg);color:var(--warn)}
.pill.active{background:var(--ok-bg);color:var(--ok)}
.empty{padding:44px 20px;text-align:center;color:var(--muted)}
.empty .btn{margin-top:14px}
.row-actions{display:flex;gap:6px;flex-wrap:nowrap}

/* mobile card list — replaces the table on small screens */
.card-list{display:none;flex-direction:column;gap:12px}
.arch-card{border:1px solid var(--line);border-radius:12px;padding:16px;background:#fff}
.arch-card .ac-head{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;margin-bottom:10px}
.arch-card .ac-name{font-family:var(--font-display);font-weight:700;font-size:1rem}
.arch-card .ac-date{font-size:.75rem;color:var(--muted);margin-top:2px}
.arch-card dl{display:grid;grid-template-columns:88px 1fr;gap:6px 10px;font-size:.85rem;margin-bottom:12px}
.arch-card dt{color:var(--muted)}
.arch-card dd{word-break:break-word}
.arch-card .ac-actions{display:flex;gap:8px}
.arch-card .ac-actions .copy-btn{flex:1}

/* ---------- 14. MODAL ---------- */
.modal-overlay{
  position:fixed;inset:0;background:rgba(17,72,110,.55);z-index:70;
  display:flex;align-items:flex-start;justify-content:center;
  padding:24px 14px;overflow-y:auto;
}
.modal-overlay[hidden]{display:none !important}
.modal{
  background:#fff;border-radius:var(--radius);width:100%;max-width:560px;
  box-shadow:0 20px 60px rgba(0,0,0,.3);margin:auto;
}
.modal-head{
  display:flex;align-items:center;justify-content:space-between;
  padding:18px 22px;border-bottom:1px solid var(--line);
  position:sticky;top:0;background:#fff;border-radius:var(--radius) var(--radius) 0 0;
}
.modal-head h2{font-family:var(--font-display);font-weight:800;font-size:1.3rem}
.modal-x{
  background:none;border:none;font-size:1.5rem;line-height:1;color:var(--ink);
  width:38px;height:38px;border-radius:8px;display:grid;place-items:center;
}
.modal-x:hover{background:var(--bg)}
.modal-body{padding:20px 22px}
body.no-scroll{overflow:hidden}

/* ---------- 15. TOAST ---------- */
.toast{
  position:fixed;bottom:20px;left:50%;
  transform:translateX(-50%) translateY(140%);
  background:var(--navy-dark);color:#fff;
  padding:13px 20px;border-radius:10px;font-size:.88rem;
  box-shadow:var(--shadow);z-index:99;
  max-width:calc(100% - 32px);text-align:center;
  transition:transform .25s ease;
}
.toast.show{transform:translateX(-50%) translateY(0)}

/* =============================================================
   16. RESPONSIVE BREAKPOINTS
   ============================================================= */

/* --- tablet / small laptop --- */
@media (max-width:1024px){
  .main{padding:24px 22px}
}

/* --- MOBILE + TABLET: sidebar becomes a slide-in drawer --- */
@media (max-width:900px){
  .mobile-bar{display:flex}

  .sidebar{
    transform:translateX(-100%);
    transition:transform .28s ease;
    box-shadow:0 0 40px rgba(0,0,0,.3);
    width:min(280px, 84vw);
  }
  .sidebar.open{transform:translateX(0)}
  .sidebar-close{display:grid;place-items:center}
  .sidebar .brand{padding-right:52px}

  .main{margin-left:0;padding:20px 16px;max-width:100%}

  .login-wrap{grid-template-columns:1fr}
  .login-left{min-height:auto;padding:28px 22px;gap:26px}
  .login-left::after{width:280px;height:280px;right:-90px;bottom:-90px}
  .login-right{padding:32px 20px}
  .login-foot{display:none}

  .form-grid{grid-template-columns:1fr}
  .form-actions{flex-direction:column-reverse}
  .form-actions .btn{width:100%}
}

/* --- PHONES --- */
@media (max-width:640px){
  html{font-size:15px}
  .topbar h1{font-size:1.3rem}
  .topbar > .btn{width:100%}
  .panel{padding:20px 16px}
  .stat{padding:16px}
  .stat .num{font-size:1.7rem}
  .stat-grid{grid-template-columns:1fr;gap:12px}

  /* stepper compacts to dots only */
  .step span:not(.dot){display:none}
  .step.now span:not(.dot){display:inline}
  .step-bar{width:20px}

  /* swap tables for stacked cards */
  .table-wrap{display:none}
  .card-list{display:flex}

  .cred-row{flex-direction:column;align-items:flex-start;gap:6px}
  .cred-row .copy-btn{align-self:stretch;text-align:center}
  .share-grid{grid-template-columns:1fr}

  .modal-overlay{padding:0}
  .modal{border-radius:0;min-height:100vh}
  .modal-head{border-radius:0}

  .login-hero h1{font-size:1.6rem}
}

/* --- accessibility --- */
@media (prefers-reduced-motion:reduce){
  *{transition:none !important;animation:none !important}
}
