/* =========================================================================
   polish.css — login, toasts, live-clock, transitions, responsive, device frames
   ========================================================================= */

/* ---------- Page transitions ---------- */
.page-transition { animation: pt-in 300ms cubic-bezier(.2,.8,.2,1); }
@keyframes pt-in  { 0% { opacity: 0.3; transform: translateY(4px); } 100% { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .page-transition { animation: none; } }

/* Sidebar nav item — smoother hover */
.nav-item { transition: background 120ms, color 120ms; }
.nav-item::before { transition: transform 200ms cubic-bezier(.2,.8,.2,1); transform-origin: top; transform: scaleY(0); }
.nav-item.active::before { transform: scaleY(1); }

/* Button ripple / press */
.btn, .iconbtn { transition: background 120ms, border-color 120ms, transform 90ms, box-shadow 120ms; }
.btn:active, .iconbtn:active { transform: translateY(1px); }
.btn--primary:hover { box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 2px 6px rgba(216,79,16,0.35); }

/* Tab underline slide */
.tabs__item { position: relative; transition: color 140ms; }
.tabs__item.active { transition: color 140ms; }

/* Card hover lift (lists of cards) */
.kanban__card { transition: border-color 140ms, box-shadow 140ms, transform 140ms; }
.kanban__card:hover { transform: translateY(-1px); }

/* ---------- Live clock in topbar ---------- */
.live-clock {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 10px;
  border-radius: 4px; border: 1px solid var(--line); background: #fff;
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-1);
  font-variant-numeric: tabular-nums;
}
.live-clock__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(27,125,75,0.5); animation: pulse-dot 1.6s ease-out infinite; }
@keyframes pulse-dot { 0% { box-shadow: 0 0 0 0 rgba(27,125,75,0.5); } 70% { box-shadow: 0 0 0 6px rgba(27,125,75,0); } 100% { box-shadow: 0 0 0 0 rgba(27,125,75,0); } }
.live-clock__sec { color: var(--ink-3); }
.live-clock__ampm { color: var(--ink-3); font-size: 10.5px; letter-spacing: 0.04em; }

/* ---------- Toast stack ---------- */
.toast-stack { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 300; pointer-events: none; }
.toast {
  pointer-events: auto;
  min-width: 300px; max-width: 380px;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 6px;
  box-shadow: 0 14px 30px -12px rgba(20,20,20,0.22), 0 2px 6px rgba(0,0,0,0.06);
  animation: toast-in 280ms cubic-bezier(.2,.8,.2,1) both;
  font-size: 12px;
}
.toast__icon { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.toast--info .toast__icon { background: var(--info-soft); color: var(--info); }
.toast--ok   .toast__icon { background: var(--ok-soft);   color: var(--ok); }
.toast--crit .toast__icon { background: var(--crit-soft); color: var(--crit); }
.toast--info { border-left: 3px solid var(--info); }
.toast--ok   { border-left: 3px solid var(--ok); }
.toast--crit { border-left: 3px solid var(--crit); }
.toast__title { font-weight: 600; color: var(--ink-0); font-size: 12.5px; }
.toast__sub { color: var(--ink-2); font-size: 11.5px; margin-top: 2px; line-height: 1.35; }
.toast__action { font-size: 11px; font-weight: 600; color: var(--orange); padding: 4px 8px; border-radius: 3px; }
.toast__action:hover { background: var(--orange-soft); }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px) scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- Login ---------- */
.login {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  background: #0E1116;
  animation: login-in 260ms ease-out both;
}
.login--leaving { animation: login-out 320ms cubic-bezier(.4,0,.2,1) forwards; }
@keyframes login-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes login-out { to { opacity: 0; transform: scale(1.02); } }

.login__bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(1200px 700px at 10% 10%, rgba(232,97,31,0.18), transparent 60%),
    radial-gradient(900px 600px at 90% 90%, rgba(31,90,42,0.45), transparent 55%),
    linear-gradient(160deg, #0E1116 0%, #15211A 100%);
}
.login__grain { position: absolute; inset: 0; opacity: 0.08; mix-blend-mode: overlay;
  background-image: radial-gradient(rgba(255,255,255,0.6) 1px, transparent 1px);
  background-size: 3px 3px;
}

.login__shell {
  position: relative;
  width: min(980px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 32px));
  display: grid; grid-template-columns: 1.05fr 1fr;
  background: #1C1F25; border: 1px solid rgba(255,255,255,0.08); border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 60px 120px -30px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04) inset;
}

/* left panel — brand */
.login__side {
  position: relative;
  padding: 34px 38px;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(600px 300px at 80% 0%, rgba(232,97,31,0.22), transparent 60%),
    linear-gradient(170deg, #1F3A2D 0%, #16281F 100%);
  color: #EAE8E2;
  overflow: hidden;
}
.login__side::after {
  content: ''; position: absolute; inset: -30% -30% auto auto; width: 80%; height: 80%;
  background: radial-gradient(closest-side, rgba(232,97,31,0.15), transparent 70%);
  pointer-events: none;
}
.login__brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.login__mark { width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; box-shadow: 0 8px 20px -6px rgba(232,97,31,0.5); }
.login__name { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: #fff; letter-spacing: -0.01em; }
.login__sub { font-size: 11px; color: rgba(234,231,226,0.55); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 3px; font-family: var(--font-mono); }

.login__quote { position: relative; z-index: 1; max-width: 380px; }
.login__q-mark { font-family: var(--font-serif); font-size: 72px; line-height: 0.5; color: var(--orange); opacity: 0.7; margin-bottom: 4px; }
.login__quote p { font-family: var(--font-serif); font-size: 22px; line-height: 1.3; color: #fff; margin: 0 0 18px; font-style: italic; letter-spacing: -0.005em; }
.login__q-by { display: flex; align-items: center; gap: 10px; }
.login__q-avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(140deg, #E8611F, #C94B0D); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; }

.login__stamp { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-end; font-family: var(--font-mono); font-size: 10.5px; color: rgba(234,231,226,0.45); letter-spacing: 0.06em; }
.login__stamp-time { font-size: 14px; color: rgba(255,255,255,0.75); letter-spacing: 0.02em; }
.login__stamp-date { text-transform: uppercase; }

/* right panel — form */
.login__form-wrap { background: #FAF9F5; display: grid; place-items: center; padding: 40px; position: relative; }
.login__form { width: 100%; max-width: 340px; display: flex; flex-direction: column; }
.login__form--shake { animation: shake 260ms cubic-bezier(.36,.07,.19,.97); }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); } 30%, 50%, 70% { transform: translateX(-4px); } 40%, 60% { transform: translateX(4px); } }

.login__eyebrow { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--orange); font-weight: 600; margin-bottom: 12px; }
.login__heading { font-family: var(--font-serif); font-size: 30px; font-weight: 400; margin: 0; letter-spacing: -0.02em; color: #15181F; line-height: 1.1; }
.login__lede { margin: 10px 0 28px; color: var(--ink-2); font-size: 13px; line-height: 1.4; }

.login__label { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.login__input { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; margin-bottom: 16px; transition: border-color 140ms, box-shadow 140ms; }
.login__input:focus-within { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(232,97,31,0.15); }
.login__input input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 13px; color: var(--ink-0); }
.login__input--disabled { color: var(--ink-2); font-size: 13px; background: var(--panel-2); }
.login__check { color: var(--ok); display: inline-flex; }

.login__cta {
  height: 42px; border-radius: 6px;
  background: linear-gradient(180deg, #E8611F 0%, #C94B0D 100%);
  color: #fff; font-weight: 600; font-size: 13px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 6px 16px -4px rgba(232,97,31,0.45), 0 1px 0 rgba(255,255,255,0.25) inset;
  transition: transform 90ms, box-shadow 160ms;
  margin-top: 6px;
}
.login__cta:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -6px rgba(232,97,31,0.55), 0 1px 0 rgba(255,255,255,0.25) inset; }
.login__cta:active { transform: translateY(0); }
.login__cta--loading { opacity: 0.9; }
.login__cta:disabled { cursor: wait; }
.login__spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login__sso { height: 40px; border-radius: 6px; border: 1px solid var(--line-strong); background: #fff; margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 500; font-size: 12.5px; color: var(--ink-1); transition: background 120ms; }
.login__sso:hover { background: var(--hover); }
.login__sso-g { width: 18px; height: 18px; border-radius: 50%; background: linear-gradient(135deg, #4285F4 0%, #EA4335 50%, #FBBC05 100%); color: #fff; font-weight: 700; font-size: 11px; display: grid; place-items: center; }

.login__meta { display: flex; justify-content: space-between; margin-top: 22px; font-size: 10.5px; color: var(--ink-3); font-family: var(--font-mono); letter-spacing: 0.04em; }
.login__meta span { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Install pill ---------- */
.login__install-wrap { margin-top: 14px; }
.login__install {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 11px 14px;
  background: #FFF5EE;
  border: 1px solid #F3D4BD;
  border-radius: 10px;
  color: #9C3D15;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  text-align: left;
}
.login__install:hover { background: #FFEAD9; border-color: #E8A978; }
.login__install:active { transform: translateY(1px); }
.login__install-arrow { margin-left: auto; font-size: 13px; color: #C25414; }
.login__install--ok {
  background: #EEF7E9; border-color: #CFE5C2; color: #3E6B2A;
  cursor: default;
}
.login__install--ok:hover { background: #EEF7E9; border-color: #CFE5C2; }
.login__install--muted {
  background: transparent; border: 1px dashed var(--stroke);
  color: var(--ink-3);
  cursor: default;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
}
.login__install--muted:hover { background: transparent; border-color: var(--stroke); }
.login__install-hint {
  margin-top: 8px; padding: 10px 12px;
  background: #FFF; border: 1px solid var(--stroke); border-radius: 8px;
  font-size: 11.5px; color: var(--ink-2); line-height: 1.5;
}
.login__install-hint b { color: var(--ink-1); font-weight: 600; }
.login__ios-share { display: inline-block; padding: 0 4px; color: #0A84FF; font-weight: 600; }

/* ---------- Device toggle (top-right floating) ---------- */
.device-toggle {
  position: fixed; top: 16px; right: 16px; z-index: 150;
  display: inline-flex; background: rgba(15,17,22,0.85); backdrop-filter: blur(8px);
  border-radius: 22px; padding: 3px; gap: 2px;
  box-shadow: 0 8px 24px -6px rgba(0,0,0,0.3);
}
.device-toggle__b {
  width: 30px; height: 28px; border-radius: 18px;
  display: grid; place-items: center; color: rgba(255,255,255,0.6);
  transition: background 140ms, color 140ms;
}
.device-toggle__b:hover { color: #fff; }
.device-toggle__b.active { background: var(--orange); color: #fff; }

/* Device-framed viewport modes */
.device-stage {
  min-height: 100vh; display: grid; place-items: center;
  padding: 30px;
  background:
    radial-gradient(900px 600px at 80% -20%, #252A33 0%, transparent 60%),
    linear-gradient(170deg, #0E1116 0%, #181B22 100%);
}
.device-stage .page { background: transparent; padding: 0; }

.device-frame--tablet {
  width: 1180px; height: 820px;
  background: #1a1d24; border-radius: 38px;
  padding: 22px;
  box-shadow: 0 40px 100px -20px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06) inset;
  position: relative;
}
.device-frame--tablet > .chrome { border-radius: 18px; height: 100%; }
.device-frame--tablet::before { content: ''; position: absolute; top: 50%; right: 10px; transform: translateY(-50%); width: 4px; height: 60px; border-radius: 4px; background: rgba(255,255,255,0.08); }

.device-frame--mobile {
  width: 400px; height: 820px;
  background: #0b0d12; border-radius: 44px;
  padding: 12px;
  box-shadow: 0 40px 100px -20px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.08) inset;
  position: relative; overflow: hidden;
}
.device-frame--mobile::before {
  content: ''; position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  width: 110px; height: 28px; background: #000; border-radius: 18px; z-index: 2;
}
.device-frame--mobile > .mobile-shell { height: 100%; background: var(--bg); border-radius: 34px; overflow: hidden; position: relative; }

/* ---------- Mobile shell (crew app) ---------- */
.mshell { height: 100%; display: flex; flex-direction: column; background: #F4F2EC; font-size: 14px; -webkit-font-smoothing: antialiased; }
.mshell__status { height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: #15181F; background: #fff; }
.mshell__header { padding: 14px 18px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.mshell__greet { font-family: var(--font-serif); font-size: 26px; letter-spacing: -0.02em; line-height: 1.1; margin-top: 2px; color: var(--ink-0); }
.mshell__submeta { display: flex; gap: 10px; margin-top: 8px; font-size: 11.5px; color: var(--ink-3); font-family: var(--font-mono); letter-spacing: 0.02em; }
.mshell__body { flex: 1; overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }
.mshell__card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.mshell__card--active { border-color: var(--orange); box-shadow: 0 10px 30px -12px rgba(232,97,31,0.35); }
.mshell__eyebrow { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.mshell__tabs { display: flex; border-top: 1px solid var(--line); background: #fff; padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px)); }
.mshell__tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0; color: var(--ink-3); font-size: 10.5px; font-weight: 500; letter-spacing: 0.02em; background: transparent; border: none; cursor: pointer; transition: color 0.15s; }
.mshell__tab.active { color: var(--orange); }
.mshell__big { height: 48px; border-radius: 10px; background: var(--orange); color: #fff; font-weight: 600; font-size: 14.5px; width: 100%; margin-top: 12px; display: flex; align-items: center; justify-content: center; gap: 7px; border: none; cursor: pointer; box-shadow: 0 6px 18px -6px rgba(232,97,31,0.45); }
.mshell__big:active { transform: translateY(1px); }
.mshell__status { height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: #15181F; background: transparent; padding-top: 10px; }
.mshell__header { padding: 8px 18px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.mshell__greet { font-family: var(--font-serif); font-size: 22px; letter-spacing: -0.02em; }
.mshell__submeta { display: flex; gap: 14px; margin-top: 4px; font-size: 11px; color: var(--ink-3); font-family: var(--font-mono); }
.mshell__body { flex: 1; overflow-y: auto; padding: 14px; }
.mshell__card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 10px; }
.mshell__card--active { border-color: var(--orange); box-shadow: 0 6px 20px -8px rgba(232,97,31,0.35); }
.mshell__eyebrow { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.mshell__tabs { display: flex; border-top: 1px solid var(--line); background: #fff; padding: 4px 0 calc(4px + env(safe-area-inset-bottom, 0px)); }
.mshell__tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; color: var(--ink-3); font-size: 10px; font-weight: 500; }
.mshell__tab.active { color: var(--orange); }
.mshell__big { height: 46px; border-radius: 8px; background: var(--orange); color: #fff; font-weight: 600; font-size: 14px; width: 100%; margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 8px; }

/* ---------- Responsive ---------- */
/* Auto-respond when page is viewed on a small screen */
@media (max-width: 900px) {
  .page { padding: 0; }
  .chrome { border-radius: 0; border: 0; width: 100%; }
  .chrome__bar { display: none; }
  .app { grid-template-columns: 1fr; min-height: 100vh; }
  .sidebar { display: none; }
  .topbar { height: 52px; padding: 0 14px; gap: 10px; }
  .search { width: auto; flex: 1; }
  .crumb { display: none; }
  .content { padding: 16px; min-height: calc(100vh - 52px); }
  .content--bleed { padding: 0; }
  .device-toggle { display: none; }
  .kanban { grid-template-columns: 1fr; }
  .tbl { font-size: 12px; }
  .tbl th, .tbl td { padding: 10px 12px; }
  .drawer { width: 100vw; }
  .toast-stack { right: 8px; left: 8px; bottom: 8px; }
  .toast { min-width: 0; max-width: 100%; }
  .login__shell { grid-template-columns: 1fr; height: auto; max-height: 95vh; overflow-y: auto; }
  .login__side { padding: 24px; }
  .login__quote p { font-size: 18px; }
  .login__form-wrap { padding: 28px 24px; }
}
@media (max-width: 1180px) and (min-width: 901px) {
  .kanban { grid-template-columns: repeat(3, 1fr); }
  .content { padding: 20px; }
}

/* Framed mode overrides — children should ignore viewport and use parent sizing */
.device-frame--tablet .page { min-height: 0; height: 100%; }
.device-frame--mobile .page { display: none; }
