/* ============================================================
   app.css — the signed-in area (login, dashboard, delete account).
   Layers on base.css exactly like home.css and legal.css do.

   1. Shell + boot/gate
   2. Sidebar
   3. Content head
   4. Job cards
   5. Skeletons, empty + error states
   6. Lightbox
   7. Modal
   8. Auth card (login)
   9. Danger page (delete account)
   10. Breakpoints
   ============================================================ */

/* ============================================================
   1. Shell + boot / gate
   ============================================================ */
.app-body{background:var(--bg-2); min-height:100vh}
/* The boot, gate and app panels are toggled with the hidden attribute, and .boot/.gate carry a
   display of their own — a class selector beats the UA [hidden] rule, so state it explicitly. */
[hidden]{display:none !important}

.boot{min-height:70vh; display:grid; place-items:center; padding:var(--gutter)}
.spinner{
  width:26px; height:26px; border-radius:50%;
  border:2.5px solid var(--pink-tint); border-top-color:var(--pink);
  animation:spin .7s linear infinite;
}
.spinner--sm{width:16px; height:16px; border-width:2px}
@keyframes spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion: reduce){ .spinner{animation:none; border-top-color:var(--pink-tint)} }

.gate{min-height:100vh; display:grid; place-items:center; padding:var(--gutter)}
.gate__card{
  background:#fff; border:1px solid var(--line); border-radius:var(--r-xl);
  box-shadow:var(--shadow-md); padding:clamp(28px,5vw,44px); max-width:440px; width:100%;
  text-align:center; display:flex; flex-direction:column; align-items:center; gap:var(--s3);
}
.gate__card img.mark{height:34px; width:auto; margin-bottom:var(--s1)}
.gate__card h1{font-size:clamp(21px,3.6vw,26px); font-weight:700; letter-spacing:-.02em}

/* ============================================================
   2. Sidebar
   ============================================================ */
.shell{display:grid; grid-template-columns:264px minmax(0,1fr); min-height:100vh}

.side{
  background:#fff; border-right:1px solid var(--line);
  position:sticky; top:0; height:100vh;
  display:flex; flex-direction:column; padding:22px 16px;
}
.side__brand{display:flex; align-items:center; padding:4px 10px 22px}
.side__brand img{height:34px; width:auto}
.side__nav{display:flex; flex-direction:column; gap:4px}
.side__label{
  font-size:10.5px; font-weight:700; letter-spacing:.14em; text-transform:uppercase;
  color:var(--ink-3); padding:0 12px 10px;
}
.side a.nav-item,.side button.nav-item{
  display:flex; align-items:center; gap:12px; width:100%; text-align:left;
  padding:11px 12px; border-radius:11px; font-size:15px; font-weight:600; color:var(--ink-2);
  transition:background-color .2s, color .2s;
}
.nav-item .icon{width:20px; height:20px; color:var(--ink-3); transition:color .2s}
.nav-item:hover{background:var(--bg-2); color:var(--ink)}
.nav-item:hover .icon{color:var(--ink-2)}
.nav-item.is-active{background:var(--pink-tint); color:var(--pink)}
.nav-item.is-active .icon{color:var(--pink)}
.nav-item--danger{color:#B4392B}
.nav-item--danger .icon{color:#C0392B}
.nav-item--danger:hover{background:#FCEDEB; color:#A5301F}
.nav-item--danger:hover .icon{color:#A5301F}

.side__foot{margin-top:auto; padding-top:18px; border-top:1px solid var(--line); display:flex; flex-direction:column; gap:4px}
.side__user{display:flex; align-items:center; gap:10px; padding:8px 12px 14px; min-width:0}
.side__user img,.side__avatar{
  width:32px; height:32px; border-radius:50%; flex:none; object-fit:cover;
  background:var(--pink-tint); color:var(--pink);
  display:grid; place-items:center; font-size:13px; font-weight:700;
}
.side__avatar img{width:100%; height:100%; border-radius:50%; object-fit:cover}
.side__email{font-size:13px; color:var(--ink-2); overflow:hidden; text-overflow:ellipsis; white-space:nowrap}

/* Mobile top bar — hidden on desktop, drives the same nav as a slide-over. */
.topbar{
  display:none; position:sticky; top:0; z-index:40;
  align-items:center; justify-content:space-between; gap:12px;
  padding:12px var(--gutter); background:rgba(255,255,255,.9);
  backdrop-filter:saturate(1.6) blur(16px); border-bottom:1px solid var(--line);
}
.topbar img{height:30px; width:auto}
.side__scrim{display:none; position:fixed; inset:0; background:rgba(26,26,26,.4); z-index:45}

/* ============================================================
   3. Content head
   ============================================================ */
.main{min-width:0; padding:clamp(24px,3.4vw,40px) var(--gutter) 64px}
.main__head{
  display:flex; align-items:flex-end; justify-content:space-between; gap:var(--s3);
  flex-wrap:wrap; margin-bottom:var(--s4);
}
.main__head h1{font-size:clamp(24px,3.6vw,32px); font-weight:700; letter-spacing:-.024em}
.main__head p{color:var(--ink-2); font-size:14.5px; margin-top:4px}
.count{color:var(--ink-3); font-size:14px; font-weight:600}

/* ============================================================
   4. Job cards
   ============================================================ */
.grid{display:grid; gap:var(--s3); grid-template-columns:repeat(auto-fill, minmax(268px,1fr))}

.job{
  background:#fff; border:1px solid var(--line); border-radius:var(--r-lg);
  box-shadow:var(--shadow-sm); overflow:hidden; display:flex; flex-direction:column;
  transition:transform .35s var(--ease), box-shadow .35s var(--ease);
}
.job:hover{transform:translateY(-3px); box-shadow:var(--shadow-md)}

.job__hero{position:relative; width:100%; aspect-ratio:1/1; background:var(--bg-2); overflow:hidden; cursor:zoom-in}
.job__hero img{width:100%; height:100%; object-fit:cover; transition:transform .5s var(--ease)}
.job__hero:hover img{transform:scale(1.03)}
.job__hero--empty{display:grid; place-items:center; color:var(--ink-3); cursor:default}
.job__hero--empty .icon{width:34px; height:34px}

.pill{
  position:absolute; top:10px; left:10px; z-index:2;
  display:inline-flex; align-items:center; gap:6px;
  background:rgba(255,255,255,.94); backdrop-filter:blur(8px);
  color:var(--ink); font-size:11.5px; font-weight:700; line-height:1;
  padding:7px 11px; border-radius:999px; box-shadow:var(--shadow-sm);
}
.pill::before{content:""; width:6px; height:6px; border-radius:50%; background:var(--ink-3)}
.pill--done::before{background:#2E9E5B}
.pill--busy::before{background:#E8A33D}
.pill--failed{color:#B4392B}
.pill--failed::before{background:#C0392B}

.job__body{padding:14px 16px 16px; display:flex; flex-direction:column; gap:10px; flex:1}
.job__title{
  font-size:15.5px; font-weight:600; line-height:1.35; letter-spacing:-.01em;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.job__meta{display:flex; flex-wrap:wrap; gap:6px 10px; color:var(--ink-3); font-size:12.5px; font-weight:500}
.job__meta span{display:inline-flex; align-items:center; gap:6px}
.job__meta span + span::before{content:""; width:3px; height:3px; border-radius:50%; background:currentColor}
.job__err{color:#B4392B; font-size:12.5px; background:#FCEDEB; border-radius:8px; padding:8px 10px}

.thumbs{display:flex; gap:6px; margin-top:auto; padding-top:2px; flex-wrap:wrap}
.thumbs button{
  width:44px; height:44px; border-radius:9px; overflow:hidden; flex:none;
  border:1px solid var(--line); background:var(--bg-2); cursor:zoom-in;
  transition:border-color .2s, transform .2s var(--ease);
}
.thumbs button:hover{border-color:var(--pink); transform:translateY(-2px)}
.thumbs img{width:100%; height:100%; object-fit:cover}
.thumbs .more{
  display:grid; place-items:center; font-size:12px; font-weight:700; color:var(--ink-2); cursor:zoom-in;
}

.more-row{display:flex; justify-content:center; margin-top:var(--s4)}
.retention{margin-top:var(--s4); text-align:center; color:var(--ink-3); font-size:13px}

/* ============================================================
   5. Skeletons, empty + error states
   ============================================================ */
.sk{background:#fff; border:1px solid var(--line); border-radius:var(--r-lg); overflow:hidden}
.sk__hero{aspect-ratio:1/1}
.sk__line{height:12px; border-radius:6px; margin:14px 16px 0}
.sk__line--short{width:55%; margin-bottom:16px}
.sk__hero,.sk__line{background:linear-gradient(90deg,#F3EFF0 25%,#FAF7F8 37%,#F3EFF0 63%); background-size:400% 100%; animation:sheen 1.3s ease-in-out infinite}
@keyframes sheen{0%{background-position:100% 0}100%{background-position:0 0}}
@media (prefers-reduced-motion: reduce){ .sk__hero,.sk__line{animation:none} }

.state{
  background:#fff; border:1px solid var(--line); border-radius:var(--r-xl);
  padding:clamp(32px,6vw,56px) var(--s4); text-align:center;
  display:flex; flex-direction:column; align-items:center; gap:var(--s2);
}
.state .med{margin-bottom:var(--s1)}
.state h2{font-size:19px; font-weight:700; letter-spacing:-.015em}
.state p{color:var(--ink-2); font-size:14.5px; max-width:44ch}
.state .btn{margin-top:var(--s2)}

/* ============================================================
   6. Lightbox
   ============================================================ */
.lb{position:fixed; inset:0; z-index:90; display:none; background:rgba(18,14,15,.92)}
.lb[open],.lb.is-open{display:grid; grid-template-rows:auto 1fr auto}
.lb__bar{display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 18px; color:#fff}
.lb__count{font-size:13.5px; font-weight:600; color:rgba(255,255,255,.72)}
.lb__actions{display:flex; align-items:center; gap:8px}
.lb__icon{
  width:40px; height:40px; border-radius:11px; display:grid; place-items:center;
  color:#fff; background:rgba(255,255,255,.1); transition:background-color .2s;
}
.lb__icon:hover{background:rgba(255,255,255,.2)}
/* Flex, not grid: a grid track sizes to the image and the tall renders (2000px square) escape the
   viewport. A flex item's max-height:100% resolves against the definite row height. */
.lb__stage{position:relative; display:flex; align-items:center; justify-content:center; padding:0 clamp(8px,4vw,64px); min-height:0; overflow:hidden}
.lb__stage img{max-width:100%; max-height:100%; width:auto; object-fit:contain; border-radius:var(--r-sm)}
.lb__nav{
  position:absolute; top:50%; transform:translateY(-50%);
  width:46px; height:46px; border-radius:50%; display:grid; place-items:center;
  color:#fff; background:rgba(255,255,255,.12); transition:background-color .2s;
}
.lb__nav:hover{background:rgba(255,255,255,.24)}
.lb__nav[hidden]{display:none}
.lb__nav--prev{left:10px} .lb__nav--prev .icon{transform:rotate(180deg)}
.lb__nav--next{right:10px}
.lb__cap{padding:14px 18px 22px; text-align:center; color:rgba(255,255,255,.72); font-size:13.5px}

/* ============================================================
   7. Modal
   ============================================================ */
.modal{position:fixed; inset:0; z-index:95; display:none; place-items:center; padding:var(--gutter); background:rgba(26,26,26,.5)}
.modal.is-open{display:grid}
.modal__box{
  background:#fff; border-radius:var(--r-xl); box-shadow:var(--shadow-md);
  padding:clamp(24px,4vw,34px); max-width:460px; width:100%;
  display:flex; flex-direction:column; gap:var(--s3);
}
.modal__box h2{font-size:20px; font-weight:700; letter-spacing:-.018em}
.modal__box p{color:var(--ink-2); font-size:14.5px}
.modal__actions{display:flex; gap:10px; justify-content:flex-end; flex-wrap:wrap}

/* ============================================================
   8. Auth card (login)
   ============================================================ */
.auth{min-height:100vh; display:grid; place-items:center; padding:var(--gutter)}
.auth__card{
  background:#fff; border:1px solid var(--line); border-radius:var(--r-xl); box-shadow:var(--shadow-md);
  padding:clamp(30px,5vw,46px); max-width:430px; width:100%; text-align:center;
  display:flex; flex-direction:column; align-items:center; gap:var(--s3);
}
.auth__card img.mark{height:36px; width:auto}
.auth__card h1{font-size:clamp(22px,3.8vw,27px); font-weight:700; letter-spacing:-.022em}
.auth__card .lead{max-width:34ch}
.auth__slot{min-height:44px; display:grid; place-items:center; width:100%}
.auth__busy{display:none; align-items:center; gap:10px; color:var(--ink-2); font-size:14.5px}
.auth__busy.is-on{display:flex}
.auth__foot{color:var(--ink-3); font-size:12.5px; margin-top:var(--s1)}
.auth__foot a{color:var(--ink-2); text-decoration:underline; text-underline-offset:2px}

.notice{
  display:none; width:100%; text-align:left; border-radius:var(--r); padding:14px 16px;
  font-size:14px; line-height:1.5; background:#FCEDEB; color:#8E2C1F; border:1px solid #F3D6D1;
}
.notice.is-on{display:block}
.notice strong{display:block; font-weight:700; margin-bottom:2px}
.notice .btn{margin-top:12px}

/* ============================================================
   9. Danger page (delete account)
   ============================================================ */
.doc-app{max-width:720px; margin-inline:auto; padding:clamp(28px,5vw,56px) var(--gutter) 80px}
.doc-app h1{font-size:clamp(26px,4.4vw,34px); font-weight:700; letter-spacing:-.024em}
.doc-app .lead{margin-top:var(--s2)}
.doc-app section{margin-top:var(--s5)}
.doc-app h2{font-size:17px; font-weight:700; letter-spacing:-.012em; margin-bottom:var(--s2)}
.loss{display:flex; flex-direction:column; gap:10px}
.loss li{display:flex; gap:11px; align-items:flex-start; color:var(--ink-2); font-size:14.5px}
.loss .icon{width:19px; height:19px; margin-top:3px; color:#C0392B; flex:none}
.warnbox{
  background:#FCEDEB; border:1px solid #F3D6D1; border-radius:var(--r); padding:16px 18px;
  color:#8E2C1F; font-size:14.5px; line-height:1.55;
}
.whoami{
  display:flex; align-items:center; gap:12px; background:#fff; border:1px solid var(--line);
  border-radius:var(--r); padding:14px 16px;
}
.whoami .side__avatar{width:38px; height:38px; font-size:14px}
.whoami b{font-weight:600; font-size:14.5px}
.whoami span{display:block; color:var(--ink-3); font-size:12.5px}
.back-link{display:inline-flex; align-items:center; gap:8px; color:var(--ink-2); font-size:14px; font-weight:600; margin-bottom:var(--s3)}
.back-link:hover{color:var(--pink)}
.back-link .icon{width:16px; height:16px; transform:rotate(180deg)}

/* ============================================================
   10. Breakpoints
   ============================================================ */
@media (max-width:900px){
  .shell{grid-template-columns:1fr}
  .topbar{display:flex}
  .side{
    position:fixed; inset:0 auto 0 0; width:min(84vw,300px); z-index:50;
    transform:translateX(-102%); transition:transform .35s var(--ease);
    box-shadow:var(--shadow-md); border-right:1px solid var(--line);
  }
  .side.is-open{transform:none}
  .side__scrim.is-on{display:block}
  .main{padding-top:var(--s4)}
}
@media (max-width:520px){
  .grid{grid-template-columns:repeat(auto-fill, minmax(150px,1fr)); gap:var(--s2)}
  .job__body{padding:12px 13px 14px}
  .job__title{font-size:14px}
  .thumbs button{width:38px; height:38px}
}
