:root {
  --ink: #172923;
  --muted: #6d7d76;
  --line: #dfe9e3;
  --paper: #f5f8f6;
  --white: #ffffff;
  --green: #276b58;
  --green-dark: #1b5142;
  --green-soft: #e4f1eb;
  --gold: #d99f3f;
  --red: #a94f43;
  --shadow: 0 8px 24px rgba(25, 65, 50, .07);
  --radius: 14px;
}
* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px 'DM Sans', sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, .tap-target { -webkit-tap-highlight-color: transparent; user-select: none; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tap-target:focus-visible { outline: 3px solid #e7b958; outline-offset: 3px; }
::selection { background: #bfe2d1; color: var(--ink); }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 244px; display: flex; flex-direction: column; padding: 26px 16px; background: #193d34; color: #dcebe4; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: #f5fbf7; font: 800 20px 'Plus Jakarta Sans'; letter-spacing: -.7px; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: #d8ece0; color: var(--green-dark); font-size: 16px; }
.sidebar nav { display: grid; gap: 6px; margin-top: 46px; }
.nav-item { width: 100%; min-height: 46px; border: 0; border-radius: 11px; padding: 11px 13px; background: transparent; color: #a7c0b5; text-align: left; font-weight: 700; }
.nav-item span { display: inline-block; width: 25px; color: #8faea0; font-size: 18px; }
.nav-item:hover, .nav-item.active { background: #2c6654; color: #fff; }
.nav-item.active span { color: #f1c86e; }
.sidebar-bottom { margin-top: auto; }
.mini-user { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; border-top: 1px solid #376052; padding: 18px 8px 0; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #efd1ad; color: #664c36; font-size: 12px; font-weight: 800; }
.account-copy { min-width: 0; }
.account-copy strong, .account-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { color: #f0f7f3; font-size: 12px; }
.account-copy small { margin-top: 3px; color: #9bb8ab; font-size: 11px; }
.logout-btn { min-height: 42px; border: 0; border-radius: 9px; padding: 9px 10px; background: #dceee5; color: #234d40; font-size: 11px; font-weight: 800; }
.logout-btn:hover { background: #fff; }
.main-content { width: calc(100% - 244px); min-height: 100vh; margin-left: 244px; padding: 32px clamp(20px, 4vw, 60px) 72px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 30px; }
.page-title-wrap { display: flex; align-items: center; gap: 11px; min-width: 0; }
.topbar h1 { margin: 0; font: 800 30px 'Plus Jakarta Sans'; letter-spacing: -1px; }
.back-btn { display: none; align-items: center; gap: 5px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: var(--white); color: var(--green); font-weight: 800; box-shadow: 0 3px 10px rgba(25, 65, 50, .05); }
.back-btn:not([hidden]) { display: inline-flex; }
.back-btn:hover { border-color: #9bc8b3; background: #f0faf4; }
.top-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.primary-btn, .secondary-btn, .demo-login { min-height: 44px; border-radius: 10px; padding: 10px 15px; font-weight: 800; }
.primary-btn { border: 0; background: var(--green); color: #fff; box-shadow: 0 5px 13px rgba(39, 107, 88, .16); }
.primary-btn:hover { background: var(--green-dark); }
.secondary-btn { border: 1px solid var(--line); background: var(--white); color: var(--ink); }
.secondary-btn:hover { border-color: #9bc8b3; background: #f0faf4; }
.view { display: none; }
.active-view { display: block; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin-bottom: 15px; }
.section-heading h2 { margin: 0; font: 800 23px 'Plus Jakarta Sans'; letter-spacing: -.7px; }
.text-btn { min-height: 40px; border: 0; background: transparent; color: var(--green); font-weight: 800; }
.text-btn:hover { color: var(--green-dark); text-decoration: underline; }
.eyebrow { color: #83948c; font-size: 10px; font-weight: 800; letter-spacing: 1.1px; text-transform: uppercase; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 34px; }
.metric, .master-card, .table-wrap, .batch-summary { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
.metric { padding: 18px; }
.metric .metric-label { color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 8px; font: 800 27px 'Plus Jakarta Sans'; }
.metric small { color: var(--green); font-size: 11px; }
.master-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.master-card { min-height: 190px; padding: 19px; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.master-card:hover, .master-card:focus-visible { border-color: #8fc2aa; box-shadow: 0 12px 27px rgba(25, 65, 50, .12); transform: translateY(-1px); }
.master-card header, .stage-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.master-card h3 { margin: 0; font-size: 17px; }
.master-meta { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.progress-track { height: 8px; margin: 24px 0 12px; overflow: hidden; border-radius: 99px; background: #edf2ef; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.progress-row, .stage-info { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.tap-hint { display: block; margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--green); font-size: 12px; font-weight: 800; }
.badge { display: inline-flex; align-items: center; min-height: 25px; border-radius: 99px; padding: 4px 9px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.badge.pending { background: #eef2ef; color: #6f8078; }
.badge.in-progress { background: #fff1d2; color: #986b22; }
.badge.done { background: var(--green-soft); color: #267052; }
.badge.on-hold { background: #fbe5e0; color: var(--red); }
.page-heading { align-items: center; }
.filters { display: flex; gap: 8px; }
.filters input, .filters select { min-height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--white); color: var(--ink); }
.filters input { min-width: 230px; }
.filters input:focus, .filters select:focus { border-color: #8fc2aa; box-shadow: 0 0 0 3px #dff1e6; outline: 0; }
.master-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: -3px 0 14px; }
.action-disabled, .action-disabled:hover { cursor: not-allowed; opacity: .48; border-color: var(--line); background: #eef2ef; color: #718079; box-shadow: none; }
.table-wrap { overflow: hidden; }
.table-wrap table { width: 100%; border-collapse: collapse; }
.table-wrap th { padding: 14px 17px; background: #f9fbfa; color: #819189; text-align: left; font-size: 10px; letter-spacing: .8px; text-transform: uppercase; }
.table-wrap td { padding: 16px 17px; border-top: 1px solid var(--line); font-size: 13px; }
.table-wrap tbody tr { transition: background .15s ease; }
.table-wrap tbody tr:hover { background: #f2faf5; }
.table-wrap td strong { display: block; font-size: 14px; }
.table-wrap td small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.inline-progress { display: inline-block; width: 100px; height: 7px; margin-right: 7px; overflow: hidden; vertical-align: middle; border-radius: 99px; background: #edf2ef; }
.inline-progress span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.kanban { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.kanban-column { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: #eaf2ed; }
.kanban-column.stage-empty { background: #edf0ee; border-style: dashed; color: #8b9791; }
.kanban-column.stage-empty h3 { color: #7d8a84; }
.kanban-column h3 { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 12px; font-size: 13px; }
.kanban-column h3 span { color: var(--muted); font-size: 11px; }
.stage-card { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--white); box-shadow: 0 3px 10px rgba(25, 65, 50, .04); transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.stage-card:last-child { margin-bottom: 0; }
.stage-card:hover, .stage-card:focus-visible { border-color: #8fc2aa; box-shadow: 0 10px 22px rgba(25, 65, 50, .11); transform: translateY(-1px); }
.stage-card h4 { margin: 0; font-size: 14px; }
.stage-card p { margin: 6px 0 12px; color: var(--muted); font-size: 12px; }
.board-batch-code { margin: 5px 0 0 !important; font-weight: 700; }
.stage-info { padding-top: 11px; border-top: 1px solid var(--line); }
.empty-state { padding: 12px 0; color: var(--muted); font-size: 12px; }
.stage-legend { display: flex; gap: 14px; color: var(--muted); font-size: 11px; }
.stage-legend span { display: flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot.pending { background: #e4b64f; }
.dot.done { background: #5fa77f; }
.batch-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; padding: 20px; }
.batch-summary h2 { margin: 6px 0 4px; font: 800 25px 'Plus Jakarta Sans'; letter-spacing: -.7px; }
.batch-summary p { margin: 0; color: var(--muted); }
.batch-timeline { display: grid; gap: 10px; max-width: 760px; }
.detail-stage { margin: 0; }
.detail-stage.current-stage { border: 2px solid #8fc2aa; background: #fbfffc; }
.detail-stage.completed-stage { background: #f8fbf9; }
.detail-stage.future-stage { border-color: #e3e8e5; background: #eef1ef; color: #8a9690; cursor: not-allowed; opacity: .72; box-shadow: none; }
.detail-stage.future-stage h4, .detail-stage.future-stage p { color: #7f8d86; }
.stage-last-updated { margin-top: 10px; color: var(--muted); font-size: 11px; }
.stage-admin-hint { margin-top: 9px; color: var(--green); font-size: 11px; font-weight: 800; }
.stage-partial-alert { margin-top: 10px; border-radius: 8px; padding: 9px 10px; background: #fff4d9; color: #8d641f; font-size: 11px; font-weight: 800; }
.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: none; align-items: center; justify-content: center; padding: 14px; background: rgba(11, 31, 24, .52); }
.modal-backdrop.open { display: flex; }
.modal { width: min(580px, 100%); max-height: 90vh; overflow: auto; border-radius: 16px; padding: 24px; background: var(--white); box-shadow: 0 18px 55px rgba(11, 31, 24, .2); }
.modal header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.modal h2 { margin: 6px 0 0; font: 800 21px 'Plus Jakarta Sans'; }
.close-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #eef3ef; color: var(--ink); font-size: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-field { display: grid; gap: 7px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; }
.form-field input, .form-field select, .form-field textarea { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--white); color: var(--ink); }
.read-only-value { min-height: 46px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #f5f8f6; color: var(--muted); }
.form-field textarea { min-height: 82px; resize: vertical; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.form-actions button:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }
.toast { position: fixed; right: 18px; bottom: 22px; z-index: 40; max-width: min(360px, calc(100vw - 36px)); border-radius: 10px; padding: 12px 15px; background: #214d40; color: #fff; box-shadow: var(--shadow); opacity: 0; transform: translateY(20px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.auth-screen { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: #edf4ef; }
.auth-screen.hidden { display: none; }
.auth-card { width: min(420px, 100%); border: 1px solid var(--line); border-radius: 18px; padding: 32px; background: var(--white); box-shadow: var(--shadow); }
.auth-brand { margin-bottom: 36px; padding: 0; color: var(--green); }
.auth-card h1 { margin: 10px 0 7px; font: 800 27px 'Plus Jakarta Sans'; letter-spacing: -1px; }
.auth-copy { margin: 0 0 26px; color: var(--muted); line-height: 1.55; }
.auth-card form { display: grid; gap: 15px; }
.auth-submit, .demo-login { width: 100%; }
.demo-login { margin-top: 10px; border: 1px solid var(--line); background: var(--white); color: var(--green); }
.login-error { min-height: 15px; color: var(--red); font-size: 12px; }
.auth-footnote { display: block; margin-top: 17px; color: #8a9992; text-align: center; font-size: 11px; line-height: 1.4; }
.cloud-loading .app-shell { visibility: hidden; }
@media (max-width: 1050px) {
  .sidebar { width: 220px; }
  .main-content { width: calc(100% - 220px); margin-left: 220px; padding-inline: 26px; }
  .master-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  body { padding-bottom: 76px; }
  .sidebar { inset: auto 0 0; width: 100%; height: 76px; flex-direction: row; align-items: center; padding: 8px 10px; }
  .sidebar > .brand { display: none; }
  .sidebar nav { display: flex; flex: 1; justify-content: space-around; gap: 3px; margin: 0; }
  .nav-item { display: flex; min-width: 76px; min-height: 58px; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 5px 7px; font-size: 11px; text-align: center; }
  .nav-item span { width: auto; line-height: 1; }
  .sidebar-bottom { margin: 0; }
  .mini-user { display: block; border: 0; padding: 0; }
  .mini-user .avatar, .mini-user .account-copy { display: none; }
  .logout-btn { min-width: 65px; }
  .main-content { width: 100%; margin-left: 0; padding: 21px 16px 30px; }
  .topbar { align-items: stretch; flex-direction: column; gap: 14px; margin-bottom: 23px; }
  .topbar h1 { font-size: 24px; }
  .top-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .top-actions button { width: 100%; padding-inline: 7px; font-size: 12px; }
  .section-heading, .page-heading { align-items: stretch; flex-direction: column; gap: 11px; }
  .section-heading h2 { font-size: 21px; }
  .filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(125px, .7fr); }
  .filters input { min-width: 0; }
  .master-grid, .kanban { grid-template-columns: 1fr; }
  .master-card { min-height: 0; }
  .master-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .master-actions button { width: 100%; padding-inline: 6px; font-size: 11px; }
  .table-wrap { border: 0; overflow: visible; background: transparent; box-shadow: none; }
  .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; min-width: 0; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-wrap tr { margin-bottom: 11px; border: 1px solid var(--line); border-radius: 13px; padding: 13px; background: var(--white); box-shadow: var(--shadow); }
  .table-wrap td { position: relative; min-height: 30px; border: 0; padding: 4px 0 4px 43%; text-align: right; }
  .table-wrap td::before { position: absolute; left: 0; color: var(--muted); content: attr(data-label); font-size: 10px; font-weight: 800; letter-spacing: .5px; text-align: left; text-transform: uppercase; }
  .table-wrap td:first-child { padding-left: 0; text-align: left; }
  .table-wrap td:first-child::before { display: none; }
  .table-wrap td:first-child strong { font-size: 16px; }
  .inline-progress { width: 90px; }
  .batch-summary { padding: 16px; }
  .batch-summary h2 { font-size: 22px; }
  .modal { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.full { grid-column: auto; }
  .form-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .form-actions button { width: 100%; }
  .toast { bottom: 90px; }
}
