@import url("/shared/design-system.css");

:root {
  --ink: #172033;
  --muted: #667085;
  --canvas: #f0f2f6;
  --panel: #ffffff;
  --navy: var(--yns-black);
  --navy-2: var(--yns-graphite);
  --cyan: var(--yns-yellow);
  --amber: var(--yns-yellow);
  --red: var(--yns-red);
  --line: #d8dee8;
  --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgb(9 9 11 / 3%) 1px, transparent 1px),
    linear-gradient(rgb(9 9 11 / 3%) 1px, transparent 1px),
    var(--yns-off-white);
  background-size: 40px 40px;
  font: 16px/1.5 var(--yns-font-body);
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .7rem 1rem; background: white; }
.skip-link:focus { top: 1rem; }
.admin-shell { display: grid; min-height: 100vh; grid-template-columns: 280px 1fr; }
.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 100vh;
  flex-direction: column;
  color: #edf4f2;
  background:
    radial-gradient(circle at 15% 90%, rgb(78 225 193 / 18%), transparent 16rem),
    var(--navy);
  border-right: 1px solid rgb(255 255 255 / 9%);
}
.brand { display: flex; align-items: center; gap: .8rem; padding: 1.35rem; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 48px; aspect-ratio: 1; place-items: center; color: var(--navy); background: var(--cyan); border-radius: 50%; font: 900 .82rem/1 var(--yns-font-display); }
.brand strong, .brand small { display: block; }
.brand small { color: #9fb1bf; }
#admin-nav { flex: 1; overflow-y: auto; padding: .5rem .75rem 1.5rem; }
#admin-nav ul { margin: 0; padding: 0; list-style: none; }
#admin-nav a {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: .65rem;
  margin: .15rem 0;
  padding: .58rem .75rem;
  color: #c7d2dc;
  border-radius: 10px;
  text-decoration: none;
  font-size: .9rem;
}
#admin-nav a:hover, #admin-nav a[aria-current="page"] { color: white; background: var(--navy-2); }
#admin-nav a[aria-current="page"] { color: var(--yns-black); background: var(--yns-yellow); font-weight: 850; }
#admin-nav a[aria-current="page"]::before { width: 7px; height: 7px; content: ""; background: var(--yns-red); border-radius: 50%; }
.sidebar-foot { padding: 1rem 1.35rem; border-top: 1px solid rgb(255 255 255 / 10%); }
.sidebar-foot p { margin: 0 0 .7rem; color: #c7d2dc; font-size: .85rem; }
.quiet-button { min-height: 44px; padding: .5rem .8rem; color: white; background: transparent; border: 1px solid rgb(255 255 255 / 30%); border-radius: 9px; }
.workspace { min-width: 0; }
.topbar {
  position: sticky;
  z-index: 15;
  top: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 1rem;
  padding: .75rem clamp(1rem, 3vw, 2.5rem);
  background: rgb(255 255 255 / 92%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.topbar p { margin: 0; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.connection { margin-left: auto; padding: .35rem .65rem; color: #0d5834; background: #e8f7ef; border: 1px solid #a6d7bc; border-radius: 999px; font-size: .75rem; font-weight: 900; text-transform: uppercase; }
.connection.offline { color: #7c2f37; background: #fde8ea; }
.icon-button { display: none; min-width: 44px; min-height: 44px; background: white; border: 1px solid var(--line); border-radius: 10px; }
main { min-height: calc(100vh - 76px); padding: clamp(1.25rem, 4vw, 3rem); }
.page { width: min(1180px, 100%); margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.6rem; }
.eyebrow { margin: 0 0 .35rem; color: var(--yns-red); font-size: .72rem; font-weight: 950; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3 { font-family: var(--yns-font-display); line-height: 1.05; letter-spacing: -.035em; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.5rem); text-transform: uppercase; }
h2 { margin: 0 0 1rem; font-size: 1.45rem; }
.panel { padding: clamp(1rem, 3vw, 1.6rem); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 35px rgb(22 33 50 / 6%); }
.panel + .panel { margin-top: 1rem; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.metric-card { position: relative; min-height: 150px; padding: 1.2rem; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.metric-card::after { position: absolute; right: -25px; bottom: -50px; width: 110px; aspect-ratio: 1; content: ""; border: 18px solid var(--yns-yellow); border-radius: 50%; opacity: .55; }
.metric-card strong { display: block; font: 900 2.6rem/1 var(--yns-font-display); }
.metric-card span { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
label { display: grid; gap: .35rem; color: #344054; font-weight: 800; font-size: .88rem; }
input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: .65rem .75rem;
  color: var(--ink);
  background: white;
  border: 1px solid #b8c1cf;
  border-radius: 10px;
}
.check-field { display: flex; align-items: flex-start; gap: .7rem; padding: .8rem .9rem; background: #f8f7f3; border: 1px solid var(--line); border-radius: 10px; line-height: 1.45; cursor: pointer; }
.check-field input[type="checkbox"] { width: 22px; height: 22px; min-height: 22px; flex: 0 0 22px; margin: .05rem 0 0; padding: 0; accent-color: var(--yns-yellow); }
.check-field span { min-width: 0; }
textarea { min-height: 105px; resize: vertical; }
.full { grid-column: 1 / -1; }
.actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.2rem; }
.button {
  min-height: 46px;
  padding: .65rem 1rem;
  color: white;
  background: var(--navy);
  border: 1px solid var(--navy);
  border-radius: 10px;
  font-weight: 900;
}
.button:hover { background: var(--navy-2); }
.button.secondary { color: var(--yns-text); background: transparent; border-color: #77777e; }
.button.danger { background: var(--red); border-color: var(--red); }
.button:disabled { cursor: not-allowed; opacity: .45; }
.notice { margin: 1rem 0; padding: .85rem 1rem; color: #694200; background: #fff4d9; border-left: 5px solid var(--amber); }
.error { color: #7f2530; background: #fdebed; border-left-color: var(--red); }
.success { color: #185548; background: #e0f8f2; border-left-color: #2c9c84; }
.state-card { width: min(560px, 100%); margin: 8vh auto; padding: clamp(1.5rem, 5vw, 3rem); text-align: center; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.login-page { display: grid; min-height: calc(100vh - 6rem); place-items: center; }
.login-card { width: min(480px, 100%); padding: clamp(1.5rem, 5vw, 3rem); background: white; border: 1px solid var(--line); border-radius: 26px; box-shadow: 0 25px 80px rgb(22 33 50 / 14%); }
.login-card::before { display: block; width: 82px; height: 9px; margin-bottom: 2rem; content: ""; background: linear-gradient(90deg, var(--yns-yellow) 0 68%, var(--yns-red) 68%); }
.login-card h1 { margin-bottom: .5rem; }
.login-card > p { color: var(--muted); }
.login-card form { display: grid; gap: 1rem; margin-top: 1.5rem; }
.data-view { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { color: var(--muted); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; }
.key-value { display: grid; grid-template-columns: minmax(150px, .5fr) 1.5fr; margin: 0; }
.key-value dt, .key-value dd { margin: 0; padding: .65rem; border-bottom: 1px solid var(--line); }
.key-value dt { color: var(--muted); font-weight: 800; }
.key-value pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.operator-list { display: grid; gap: .65rem; }
.operator-card { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: .85rem; padding: .85rem; background: #f8f7f3; border: 1px solid var(--yns-border); border-radius: var(--yns-radius-md); }
.operator-card-order { display: grid; width: 38px; height: 38px; place-items: center; color: var(--yns-black); background: var(--yns-yellow); border-radius: 50%; font: 900 1rem/1 var(--yns-font-display); }
.operator-card-main { min-width: 0; }
.operator-card-main strong, .operator-card-main small, .operator-card-status small { display: block; }
.operator-card-main small, .operator-card-status small { margin-top: .18rem; color: var(--yns-text-muted); font-size: .75rem; }
.operator-card-status { text-align: right; }
.operator-record { overflow: hidden; background: #f8f7f3; border: 1px solid var(--yns-border); border-radius: var(--yns-radius-md); }
.active-operation { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .2rem 1rem; padding: 1rem 1.1rem; color: var(--yns-white); background: var(--yns-black); border-left: 7px solid var(--yns-yellow); border-radius: var(--yns-radius-md); }
.active-operation > span { grid-row: 1 / 3; align-self: stretch; display: grid; align-items: center; padding-right: 1rem; color: var(--yns-yellow); border-right: 1px solid #3a3a3f; font-size: .72rem; font-weight: 950; letter-spacing: .08em; text-transform: uppercase; }
.active-operation strong { font: 900 1.15rem/1.1 var(--yns-font-display); }
.active-operation small { color: #b8b8bd; }
.records-disclosure { margin-top: 1rem; }
.records-disclosure > summary { display: flex; min-height: 64px; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; cursor: pointer; list-style: none; background: white; border: 1px solid var(--line); border-radius: var(--yns-radius-md); }
.records-disclosure > summary::-webkit-details-marker { display: none; }
.records-disclosure > summary::after { content: "+"; color: var(--yns-red); font: 900 1.4rem/1 var(--yns-font-display); }
.records-disclosure[open] > summary::after { content: "−"; }
.records-disclosure > summary > span:first-child { min-width: 0; }
.records-disclosure > summary strong, .records-disclosure > summary small { display: block; }
.records-disclosure > summary small { margin-top: .15rem; color: var(--yns-text-muted); }
.records-disclosure > summary .status-badge { margin-left: auto; }
.records-disclosure > .panel { margin-top: .65rem; }

.dashboard-hero { position: relative; margin-bottom: 1rem; padding: clamp(1.5rem, 4vw, 2.5rem); overflow: hidden; color: var(--yns-white); background: var(--yns-black); border: 0; }
.dashboard-hero::after { position: absolute; right: -70px; top: -100px; width: 280px; aspect-ratio: 1; content: ""; border: 38px solid var(--yns-yellow); border-radius: 50%; opacity: .85; }
.dashboard-hero > * { position: relative; z-index: 1; }
.dashboard-hero h2 { max-width: 720px; margin-bottom: .65rem; font-size: clamp(1.7rem, 4vw, 2.7rem); text-transform: uppercase; }
.dashboard-hero p { max-width: 680px; color: #c8c8cd; }
.dashboard-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 1rem; margin-top: 1rem; }
.task-list { display: grid; gap: .65rem; margin: 0; padding: 0; list-style: none; }
.task-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem; background: #f8f7f3; border: 1px solid var(--yns-border); border-radius: var(--yns-radius-md); }
.task-item strong, .task-item small { display: block; }
.task-item small { margin-top: .15rem; color: var(--yns-text-muted); }
.status-badge { white-space: nowrap; }
.result-entry { display: grid; gap: 1rem; }
.result-entry-head { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--yns-border); }
.placement-list { display: grid; gap: .65rem; counter-reset: placement; }
.placement-row { display: grid; grid-template-columns: 48px minmax(140px, 1fr) minmax(100px, .65fr) minmax(90px, .45fr) minmax(120px, .6fr); align-items: end; gap: .65rem; padding: .8rem; background: #f8f7f3; border: 1px solid var(--yns-border); border-radius: var(--yns-radius-md); }
.placement-row label { min-width: 0; }
.placement-number { display: grid; width: 44px; height: 44px; place-items: center; color: var(--yns-black); background: var(--yns-yellow); border-radius: 50%; font: 900 1.25rem/1 var(--yns-font-display); }
.field-help { margin: .2rem 0 0; color: var(--yns-text-muted); font-size: .76rem; font-weight: 500; }
.review-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: .65rem; margin: 1rem 0; }
.review-step { padding: .85rem; background: #f4f3ef; border-radius: var(--yns-radius-md); }
.review-step strong, .review-step span { display: block; }
.review-step span { margin-top: .25rem; color: var(--yns-text-muted); font-size: .78rem; }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -300px; width: 280px; transition: left .2s ease; }
  .sidebar.open { left: 0; box-shadow: 20px 0 80px rgb(0 0 0 / 25%); }
  .icon-button { display: inline-block; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .placement-row { grid-template-columns: 42px 1fr 1fr; }
  .placement-row label:nth-last-child(-n+2) { grid-column: span 1; }
}
@media (max-width: 600px) {
  main { padding: 1rem; }
  .dashboard-hero::after { right: -150px; }
  .grid, .form-grid { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .key-value { grid-template-columns: 1fr; }
  .key-value dt { padding-bottom: 0; border-bottom: 0; }
  .full { grid-column: auto; }
  .result-entry-head { grid-template-columns: 1fr; }
  .review-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .placement-row { grid-template-columns: 40px 1fr; align-items: center; }
  .placement-row label, .placement-row label:nth-last-child(-n+2) { grid-column: 1 / -1; }
  .active-operation { grid-template-columns: 1fr; gap: .3rem; }
  .active-operation > span { grid-row: auto; padding: 0 0 .45rem; border-right: 0; border-bottom: 1px solid #3a3a3f; }
  .operator-card { grid-template-columns: 38px minmax(0, 1fr); }
  .operator-card-status { grid-column: 2; text-align: left; }
  .records-disclosure > summary .status-badge { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
