:root {
  --ink: #17221d;
  --ink-2: #25332d;
  --forest: #1f352b;
  --paper: #f4f2ec;
  --surface: #fffdfa;
  --surface-2: #f8f6f1;
  --line: #e4e1d8;
  --muted: #748079;
  --accent: #ee684c;
  --accent-soft: #fff0eb;
  --green: #2b8a61;
  --green-soft: #e7f4ed;
  --amber: #c9852c;
  --amber-soft: #fff3dd;
  --blue: #3e73a8;
  --blue-soft: #e9f1f8;
  --red: #c94c46;
  --red-soft: #fbeae8;
  --shadow: 0 14px 40px rgba(28, 37, 32, .08);
  --radius: 18px;
  --sidebar: 244px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--paper); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
body.auth-pending { overflow: hidden; }

.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: minmax(420px, 44%) 1fr;
  background: var(--surface);
}
.login-card {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(40px, 8vw, 110px);
  max-width: 700px;
}
.login-brand, .brand { display: flex; align-items: center; gap: 12px; }
.login-brand { position: absolute; top: 42px; left: clamp(40px, 8vw, 110px); }
.login-brand > span:last-child, .brand > span:last-child { display: grid; line-height: 1; }
.login-brand strong, .brand strong { letter-spacing: .19em; font-size: 16px; }
.login-brand small, .brand small { margin-top: 5px; color: var(--accent); letter-spacing: .22em; font-size: 8px; font-weight: 800; }
.brand-mark { width: 39px; height: 39px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; border: 1px solid currentColor; border-radius: 10px; transform: rotate(45deg); }
.brand-mark i { width: 4px; background: currentColor; border-radius: 3px; transform: rotate(-45deg) translate(2px, -2px); }
.brand-mark i:nth-child(1) { height: 13px; }
.brand-mark i:nth-child(2) { height: 23px; }
.brand-mark i:nth-child(3) { height: 17px; }
.login-copy { margin-bottom: 34px; }
.eyebrow { display: block; color: var(--accent); font-weight: 800; letter-spacing: .13em; text-transform: uppercase; font-size: 10px; }
.login-copy h1 { max-width: 500px; margin: 13px 0 14px; font-family: Georgia, serif; font-size: clamp(40px, 5vw, 67px); line-height: .99; font-weight: 500; letter-spacing: -.045em; }
.login-copy p { max-width: 440px; color: var(--muted); font-size: 16px; line-height: 1.6; }
.login-card form { display: grid; gap: 16px; }
.login-card label, .field-label { display: grid; gap: 7px; color: #47534d; font-size: 12px; font-weight: 700; }
input, textarea, select { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; outline: none; transition: border-color .2s, box-shadow .2s; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(238, 104, 76, .12); }
textarea { resize: vertical; }
.field-label small { color: var(--muted); font-weight: 500; }
.button { min-height: 43px; padding: 0 18px; border: 0; border-radius: 10px; font-weight: 800; font-size: 12px; cursor: pointer; transition: transform .16s, box-shadow .16s, opacity .16s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .52; cursor: wait; transform: none; }
.button.primary { color: #fff; background: var(--accent); box-shadow: 0 7px 18px rgba(238, 104, 76, .22); }
.button.dark { color: #fff; background: var(--ink); }
.button.secondary { color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); }
.button.full { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; }
.login-card .button { margin-top: 4px; height: 50px; }
.form-message { min-height: 16px; margin: 0; color: var(--red); font-size: 12px; }
.form-message.success { color: var(--green); }
.login-footnote { margin-top: 24px; color: #9aa29e; }
.login-visual { position: relative; overflow: hidden; background: #17251e; }
.login-visual::before { content: ""; position: absolute; inset: 0; opacity: .45; background: radial-gradient(circle at 65% 30%, #416951 0, transparent 34%), linear-gradient(145deg, transparent 52%, rgba(255,255,255,.04) 52%); }
.tower-lines { position: absolute; inset: 11% 15% -8% 19%; background: linear-gradient(66deg, transparent 49.7%, rgba(238,104,76,.6) 49.9%, rgba(238,104,76,.6) 50.1%, transparent 50.3%), linear-gradient(-66deg, transparent 49.7%, rgba(238,104,76,.6) 49.9%, rgba(238,104,76,.6) 50.1%, transparent 50.3%); clip-path: polygon(50% 0, 100% 100%, 0 100%); opacity: .65; }
.tower-lines::before, .tower-lines::after { content: ""; position: absolute; inset: 10% 0; background: repeating-linear-gradient(to bottom, transparent 0 58px, rgba(255,255,255,.18) 59px 61px); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.login-stat { position: absolute; left: 10%; bottom: 12%; display: grid; min-width: 180px; padding: 20px 24px; color: #fff; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 16px; backdrop-filter: blur(10px); }
.login-stat.second { left: auto; right: 10%; bottom: 27%; }
.login-stat strong { font-family: Georgia, serif; font-size: 38px; font-weight: 500; }
.login-stat span { color: #b8c5bf; font-size: 11px; text-transform: uppercase; letter-spacing: .09em; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: var(--sidebar); padding: 27px 18px 19px; display: flex; flex-direction: column; color: #f5f6f1; background: var(--ink); }
.brand { padding: 0 10px 34px; }
.brand .brand-mark { width: 34px; height: 34px; color: #f4f4ef; border-color: rgba(255,255,255,.5); }
.main-nav { display: grid; gap: 4px; }
.nav-item { position: relative; width: 100%; min-height: 42px; padding: 0 12px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 9px; color: #a9b5af; background: transparent; text-align: left; cursor: pointer; font-size: 12px; font-weight: 700; }
.nav-item > span { width: 22px; color: #88968f; font-size: 18px; text-align: center; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.045); }
.nav-item.active { color: #fff; background: #293b33; }
.nav-item.active::before { content: ""; position: absolute; left: -18px; width: 3px; height: 23px; border-radius: 0 4px 4px 0; background: var(--accent); }
.nav-item b { margin-left: auto; min-width: 21px; padding: 3px 6px; border-radius: 12px; color: #d5ded9; background: #364940; text-align: center; font-size: 9px; }
.nav-item b.alert { color: #fff; background: var(--accent); }
.shift-card { margin: auto 4px 16px; padding: 15px; border: 1px solid rgba(255,255,255,.08); border-radius: 13px; background: rgba(255,255,255,.035); }
.shift-card > div:first-child { display: flex; align-items: center; gap: 7px; color: #afbbb5; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #57c88d; box-shadow: 0 0 0 4px rgba(87,200,141,.11); }
.shift-card > strong { display: block; margin: 8px 0 13px; font-size: 13px; }
.shift-avatars { display: flex; }
.shift-avatars .avatar { width: 27px; height: 27px; margin-right: -6px; border: 2px solid var(--ink); font-size: 8px; }
.sidebar-profile { border-top: 1px solid rgba(255,255,255,.08); padding-top: 13px; }
.profile-button { width: 100%; padding: 6px; display: flex; align-items: center; gap: 10px; border: 0; color: #fff; background: transparent; cursor: pointer; text-align: left; }
.profile-button > span:nth-child(2) { min-width: 0; display: grid; flex: 1; }
.profile-button strong { overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.profile-button small { color: #8f9c96; font-size: 9px; }
.profile-button i { color: #829087; font-style: normal; }
.avatar { width: 34px; height: 34px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 50%; color: #fff; background: #486154; font-size: 10px; font-weight: 800; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.logout-button { width: 100%; margin-top: 4px; padding: 6px; border: 0; color: #87958e; background: transparent; text-align: left; cursor: pointer; font-size: 9px; }

.workspace { min-height: 100vh; margin-left: var(--sidebar); padding: 0 34px 44px; }
.topbar { min-height: 104px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topbar h1 { margin: 4px 0 0; font-family: Georgia, serif; font-size: 27px; font-weight: 500; letter-spacing: -.025em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.current-date { padding-right: 16px; display: grid; text-align: right; line-height: 1.4; border-right: 1px solid var(--line); }
.current-date strong { font-size: 11px; }
.current-date small { color: var(--muted); font-size: 9px; }
.icon-button { position: relative; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.icon-button b { position: absolute; top: -5px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border: 2px solid var(--paper); border-radius: 9px; color: #fff; background: var(--accent); font-size: 8px; line-height: 13px; }
.mobile-menu { display: none; }
.view { display: none; }
.view.active { display: block; animation: viewIn .25s ease-out; }
@keyframes viewIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 15px; }
.kpi-card { position: relative; min-height: 112px; padding: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.kpi-card::after { content: ""; position: absolute; right: -27px; top: -27px; width: 78px; height: 78px; border: 12px solid var(--tone, #e8ece9); border-radius: 50%; opacity: .58; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.kpi-top i { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; color: var(--tone-dark, var(--green)); background: var(--tone, var(--green-soft)); font-style: normal; font-size: 13px; }
.kpi-value { margin-top: 13px; display: flex; align-items: baseline; gap: 7px; }
.kpi-value strong { font-family: Georgia, serif; font-size: 29px; font-weight: 500; }
.kpi-value small { color: var(--muted); font-size: 10px; }
.kpi-card.warning { --tone: var(--amber-soft); --tone-dark: var(--amber); }
.kpi-card.danger { --tone: var(--red-soft); --tone-dark: var(--red); }
.kpi-card.blue { --tone: var(--blue-soft); --tone-dark: var(--blue); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(265px, .8fr); gap: 15px; }
.dashboard-bottom-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .85fr); gap: 15px; margin-top: 15px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 0 rgba(30,40,34,.02); }
.panel-header { min-height: 75px; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); }
.panel-header.compact { min-height: 70px; }
.panel-header h2, .section-heading h2 { margin: 4px 0 0; font-family: Georgia, serif; font-size: 20px; font-weight: 500; letter-spacing: -.02em; }
.period-switch { display: flex; padding: 3px; border-radius: 9px; background: var(--surface-2); }
.period-switch button { padding: 7px 11px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 9px; font-weight: 800; cursor: pointer; }
.period-switch button.active { color: var(--ink); background: #fff; box-shadow: 0 2px 8px rgba(20,30,25,.07); }
.count-badge, .summary-pill { border-radius: 20px; font-size: 10px; font-weight: 800; }
.count-badge { min-width: 27px; padding: 6px 8px; color: var(--accent); background: var(--accent-soft); text-align: center; }
.week-strip { display: grid; grid-template-columns: 170px repeat(7, 1fr); padding: 10px 16px 8px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 8px; font-weight: 700; text-align: center; }
.week-strip > span:first-child { text-align: left; }
.week-day { display: grid; gap: 2px; }
.week-day strong { color: var(--ink); font-size: 10px; }
.week-day.today strong { width: 22px; height: 22px; margin: -3px auto; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--accent); }
.production-timeline { padding: 4px 16px 11px; }
.timeline-row { min-height: 56px; display: grid; grid-template-columns: 170px 1fr; align-items: center; border-bottom: 1px solid #eeece6; }
.timeline-row:last-child { border-bottom: 0; }
.timeline-label { min-width: 0; padding-right: 12px; display: grid; gap: 3px; }
.timeline-label strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.timeline-label small { color: var(--muted); font-size: 8px; }
.timeline-track { position: relative; height: 24px; border-radius: 7px; background: repeating-linear-gradient(to right, transparent 0 calc(14.285% - 1px), #ece9e1 calc(14.285% - 1px) 14.285%); }
.timeline-bar { position: absolute; top: 4px; height: 16px; padding: 0 7px; display: flex; align-items: center; border-radius: 5px; color: #fff; background: var(--bar, var(--green)); font-size: 7px; font-weight: 800; white-space: nowrap; overflow: hidden; }
.timeline-bar.urgent { --bar: var(--accent); }
.timeline-bar.planned { --bar: var(--blue); }
.attention-list { padding: 4px 16px; }
.attention-item { padding: 14px 2px; display: grid; grid-template-columns: 29px 1fr auto; align-items: start; gap: 10px; border-bottom: 1px solid #ece9e3; }
.attention-item:last-child { border-bottom: 0; }
.attention-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; color: var(--red); background: var(--red-soft); font-size: 11px; font-weight: 900; }
.attention-icon.material { color: var(--amber); background: var(--amber-soft); }
.attention-copy { min-width: 0; display: grid; gap: 3px; }
.attention-copy strong { font-size: 9px; }
.attention-copy small { color: var(--muted); font-size: 8px; line-height: 1.4; }
.attention-time { padding: 3px 6px; border-radius: 9px; color: var(--red); background: var(--red-soft); font-size: 7px; font-weight: 800; white-space: nowrap; }

.text-button { border: 0; color: var(--accent); background: transparent; cursor: pointer; font-size: 9px; font-weight: 800; }
.task-list { padding: 0 18px 6px; }
.task-row { min-height: 63px; display: grid; grid-template-columns: 34px minmax(110px, 1.25fr) minmax(100px, 1fr) 72px auto; align-items: center; gap: 11px; border-bottom: 1px solid #ece9e3; }
.task-row:last-child { border-bottom: 0; }
.task-row .avatar { width: 30px; height: 30px; }
.task-copy, .task-stage { min-width: 0; display: grid; gap: 3px; }
.task-copy strong, .task-stage strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.task-copy small, .task-stage small { color: var(--muted); font-size: 8px; }
.task-time { color: var(--muted); font-size: 8px; }
.status-pill { display: inline-flex; align-items: center; justify-content: center; min-height: 23px; padding: 4px 8px; border-radius: 12px; color: var(--blue); background: var(--blue-soft); font-size: 7px; font-weight: 900; text-transform: uppercase; white-space: nowrap; }
.status-pill.done { color: var(--green); background: var(--green-soft); }
.status-pill.blocked, .status-pill.late { color: var(--red); background: var(--red-soft); }
.status-pill.waiting { color: var(--amber); background: var(--amber-soft); }
.task-action { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff; cursor: pointer; font-size: 8px; font-weight: 800; }
.live-label { display: flex; align-items: center; gap: 5px; color: var(--green); font-size: 7px; font-weight: 900; letter-spacing: .08em; }
.live-label i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.activity-list { padding: 2px 17px 8px; }
.activity-item { min-height: 63px; display: grid; grid-template-columns: 35px 1fr auto; align-items: center; gap: 10px; border-bottom: 1px solid #ece9e3; }
.activity-item:last-child { border-bottom: 0; }
.activity-item .media-thumb, .media-placeholder { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; cursor: pointer; }
.media-placeholder { display: grid; place-items: center; color: var(--green); background: var(--green-soft); font-size: 15px; }
.activity-copy { min-width: 0; display: grid; gap: 3px; }
.activity-copy strong { font-size: 9px; }
.activity-copy small { color: var(--muted); font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-time { color: #9ba49f; font-size: 7px; }

.section-heading { min-height: 92px; padding: 4px 0 19px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-heading h2 { font-size: 27px; }
.section-heading p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.summary-pill { padding: 10px 15px; color: var(--green); background: var(--green-soft); }
.today-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; align-items: start; gap: 16px; }
.task-board { display: grid; gap: 12px; }
.worker-task-card { position: relative; padding: 18px; display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 14px; border: 1px solid var(--line); border-left: 3px solid var(--status-color, var(--blue)); border-radius: 15px; background: var(--surface); }
.worker-task-card.done { --status-color: var(--green); opacity: .75; }
.worker-task-card.blocked { --status-color: var(--red); }
.worker-task-card .avatar { width: 42px; height: 42px; }
.worker-task-main { display: grid; gap: 7px; }
.worker-task-title { display: flex; align-items: center; gap: 9px; }
.worker-task-title strong { font-size: 12px; }
.worker-task-title small { color: var(--muted); font-size: 9px; }
.worker-task-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 9px; }
.worker-task-meta b { color: var(--ink); }
.worker-task-materials { display: flex; flex-wrap: wrap; gap: 5px; }
.material-chip { padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px; color: #5f6b65; background: var(--surface-2); font-size: 8px; }
.worker-task-actions { display: grid; gap: 7px; min-width: 120px; }
.material-picklist { position: sticky; top: 15px; }
.material-picklist > div { padding: 8px 19px 17px; }
.pick-row { padding: 12px 0; display: grid; grid-template-columns: 1fr auto; gap: 8px; border-bottom: 1px solid var(--line); }
.pick-row:last-child { border-bottom: 0; }
.pick-row strong { font-size: 10px; }
.pick-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
.pick-row b { color: var(--forest); font-size: 11px; }
.material-picklist > .button { width: calc(100% - 38px); margin: 0 19px 19px; }

.calendar-controls { display: flex; align-items: center; gap: 12px; }
.calendar-controls strong { min-width: 140px; font-family: Georgia, serif; font-size: 16px; text-align: center; }
.calendar-panel { overflow: hidden; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-weekday { padding: 12px; color: var(--muted); background: var(--surface-2); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 8px; font-weight: 900; text-align: center; text-transform: uppercase; }
.calendar-day { min-height: 118px; padding: 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.muted { background: #faf9f5; color: #adb4b0; }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.day-number { font-size: 10px; font-weight: 800; }
.calendar-event { margin-top: 7px; padding: 6px 7px; overflow: hidden; border-left: 3px solid var(--event-color, var(--blue)); border-radius: 5px; background: var(--blue-soft); font-size: 7px; line-height: 1.35; }
.calendar-event.urgent { --event-color: var(--accent); background: var(--accent-soft); }
.calendar-event.done { --event-color: var(--green); background: var(--green-soft); }
.calendar-event strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-event small { color: var(--muted); }

.filter-row { display: flex; gap: 6px; }
.filter-chip { padding: 8px 12px; border: 1px solid var(--line); border-radius: 18px; color: var(--muted); background: transparent; cursor: pointer; font-size: 9px; font-weight: 800; }
.filter-chip.active { color: #fff; border-color: var(--ink); background: var(--ink); }
.orders-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.order-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.order-card-head { display: flex; justify-content: space-between; gap: 12px; }
.order-card-head h3 { margin: 5px 0 3px; font-family: Georgia, serif; font-size: 20px; font-weight: 500; }
.order-card-head p { margin: 0; color: var(--muted); font-size: 9px; }
.order-priority { align-self: start; padding: 5px 8px; border-radius: 10px; color: var(--green); background: var(--green-soft); font-size: 7px; font-weight: 900; text-transform: uppercase; }
.order-priority.urgent { color: var(--red); background: var(--red-soft); }
.order-priority.high { color: var(--amber); background: var(--amber-soft); }
.order-progress { margin: 19px 0 15px; }
.progress-label { margin-bottom: 7px; display: flex; justify-content: space-between; color: var(--muted); font-size: 8px; }
.progress-label strong { color: var(--ink); }
.progress-track { height: 7px; overflow: hidden; border-radius: 6px; background: #eceae4; }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.stage-flow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.stage-node { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-size: 7px; text-align: center; }
.stage-node i { width: 100%; height: 4px; border-radius: 4px; background: #e8e5df; }
.stage-node.done i { background: var(--green); }
.stage-node.active i { background: var(--accent); }
.order-foot { margin-top: 17px; padding-top: 14px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); }
.order-foot small { color: var(--muted); font-size: 8px; }
.order-foot strong { display: block; color: var(--ink); font-size: 10px; }

.table-panel { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 10px; }
th { padding: 13px 16px; color: var(--muted); background: var(--surface-2); text-align: left; text-transform: uppercase; letter-spacing: .08em; font-size: 7px; }
td { padding: 15px 16px; border-top: 1px solid var(--line); }
td strong { font-size: 10px; }
td small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
.quantity-short { color: var(--red); font-weight: 900; }
.quantity-ok { color: var(--green); font-weight: 900; }

.document-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.document-card { min-height: 175px; padding: 18px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.document-icon { width: 42px; height: 50px; display: grid; place-items: center; border-radius: 5px 11px 5px 5px; color: var(--red); background: var(--red-soft); font-size: 10px; font-weight: 900; }
.document-icon.drawing { color: var(--blue); background: var(--blue-soft); }
.document-card h3 { margin: 15px 0 5px; font-size: 11px; }
.document-card p { margin: 0; color: var(--muted); font-size: 8px; }
.document-card footer { margin-top: auto; padding-top: 14px; display: flex; align-items: center; justify-content: space-between; }
.document-card footer small { color: var(--muted); font-size: 8px; }
.document-card footer button { border: 0; color: var(--accent); background: transparent; cursor: pointer; font-size: 9px; font-weight: 800; }

.team-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.team-card { padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.team-card-head { display: flex; align-items: center; gap: 11px; }
.team-card-head .avatar { width: 40px; height: 40px; }
.team-card-head > div { min-width: 0; display: grid; gap: 3px; }
.team-card-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.team-card-head small { color: var(--muted); font-size: 8px; }
.team-card-stats { margin-top: 16px; padding-top: 13px; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.team-card-stats span { display: grid; gap: 3px; color: var(--muted); font-size: 7px; }
.team-card-stats strong { color: var(--ink); font-size: 12px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 60; padding: 22px; display: grid; place-items: center; background: rgba(15, 24, 19, .72); backdrop-filter: blur(5px); }
.modal { width: min(660px, 100%); max-height: calc(100vh - 44px); overflow: auto; border-radius: 20px; background: var(--surface); box-shadow: 0 30px 80px rgba(5,12,8,.28); }
.modal-header { position: sticky; top: 0; z-index: 2; min-height: 80px; padding: 20px 23px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,253,250,.96); }
.modal-header h2 { margin: 4px 0 0; font-family: Georgia, serif; font-size: 23px; font-weight: 500; }
.modal-close { width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--muted); background: var(--surface-2); cursor: pointer; font-size: 22px; }
.modal form { padding: 22px 23px 24px; display: grid; gap: 16px; }
.task-modal-summary { margin: 20px 23px 0; padding: 14px; display: flex; justify-content: space-between; gap: 12px; border-radius: 11px; background: var(--surface-2); }
.task-modal-summary strong { font-size: 11px; }
.task-modal-summary small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
.confirmation-checks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.confirmation-checks label { min-height: 43px; padding: 10px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; font-size: 9px; font-weight: 700; }
.confirmation-checks input { width: auto; accent-color: var(--green); }
.upload-zone { padding: 9px; border: 1px dashed #cfcac0; border-radius: 12px; background: var(--surface-2); }
.upload-button { width: 100%; min-height: 82px; display: grid; place-items: center; gap: 3px; border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.upload-button > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: var(--accent); background: var(--accent-soft); font-size: 17px; }
.upload-button strong { color: var(--ink); font-size: 10px; }
.upload-button small { font-size: 8px; }
.upload-preview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.preview-item { position: relative; min-height: 72px; overflow: hidden; border-radius: 8px; background: #e7e6e1; }
.preview-item img, .preview-item video { width: 100%; height: 72px; object-fit: cover; }
.preview-item span { position: absolute; inset: auto 4px 4px; padding: 3px; overflow: hidden; border-radius: 4px; color: #fff; background: rgba(0,0,0,.55); font-size: 6px; text-overflow: ellipsis; white-space: nowrap; }
.upload-progress { height: 4px; overflow: hidden; border-radius: 4px; background: #dedbd4; }
.upload-progress i { display: block; height: 100%; background: var(--accent); transition: width .15s; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 4px; }
.form-grid { display: grid; gap: 13px; }
.form-grid.two { grid-template-columns: repeat(2, 1fr); }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }

.media-viewer { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 50px; background: rgba(3,7,5,.94); }
.media-viewer > .modal-close { position: absolute; top: 18px; right: 18px; color: #fff; background: rgba(255,255,255,.13); }
.media-viewer img, .media-viewer video { max-width: min(1100px, 94vw); max-height: 86vh; border-radius: 7px; }
.media-viewer iframe { width: min(1100px, 94vw); height: 86vh; border: 0; border-radius: 7px; background: #fff; }
.toast-region { position: fixed; right: 24px; bottom: 24px; z-index: 120; display: grid; gap: 8px; }
.toast { max-width: 340px; padding: 13px 16px; border-radius: 10px; color: #fff; background: var(--ink); box-shadow: var(--shadow); font-size: 10px; animation: toastIn .25s ease-out; }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
.mobile-bottom-nav { display: none; }

@media (max-width: 1180px) {
  :root { --sidebar: 218px; }
  .workspace { padding-inline: 24px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .attention-panel { display: none; }
  .document-grid, .team-grid { grid-template-columns: repeat(2, 1fr); }
  .today-layout { grid-template-columns: 1fr 300px; }
}

@media (max-width: 900px) {
  :root { --sidebar: 238px; }
  .auth-backdrop { grid-template-columns: 1fr; }
  .login-card { max-width: 620px; margin: auto; }
  .login-visual { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform .25s; box-shadow: 10px 0 35px rgba(0,0,0,.22); }
  .sidebar.open { transform: none; }
  .workspace { margin-left: 0; padding: 0 20px 85px; }
  .mobile-menu { width: 40px; height: 40px; display: block; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
  .topbar { min-height: 90px; justify-content: flex-start; }
  .topbar > div:nth-child(2) { flex: 1; }
  .current-date { display: none; }
  .dashboard-bottom-grid { grid-template-columns: 1fr; }
  .today-layout { grid-template-columns: 1fr; }
  .material-picklist { position: static; }
  .orders-grid { grid-template-columns: 1fr; }
  .mobile-bottom-nav { position: fixed; inset: auto 0 0; z-index: 18; height: 66px; padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: rgba(255,253,250,.96); backdrop-filter: blur(12px); }
  .mobile-bottom-nav button { display: grid; place-items: center; gap: 2px; border: 0; color: var(--muted); background: transparent; font-size: 8px; font-weight: 800; }
  .mobile-bottom-nav button span { font-size: 18px; }
  .mobile-bottom-nav button.active { color: var(--accent); }
}

@media (max-width: 640px) {
  .login-card { padding: 28px; justify-content: center; }
  .login-brand { position: static; margin-bottom: 60px; }
  .login-copy h1 { font-size: 42px; }
  .workspace { padding-inline: 13px; }
  .topbar { min-height: 82px; gap: 10px; }
  .topbar h1 { font-size: 20px; }
  .topbar .eyebrow { font-size: 8px; }
  .topbar-actions .button { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .kpi-card { min-height: 98px; padding: 15px; }
  .kpi-value strong { font-size: 25px; }
  .panel-header { padding-inline: 15px; }
  .week-strip { grid-template-columns: 108px repeat(7, 1fr); padding-inline: 10px; }
  .timeline-row { grid-template-columns: 108px 1fr; }
  .production-timeline { padding-inline: 10px; }
  .dashboard-bottom-grid { margin-top: 10px; gap: 10px; }
  .task-list { padding-inline: 12px; }
  .task-row { grid-template-columns: 29px 1fr auto; gap: 8px; }
  .task-row .avatar { width: 28px; height: 28px; }
  .task-stage, .task-time { display: none; }
  .section-heading { min-height: 95px; align-items: flex-end; }
  .section-heading h2 { font-size: 23px; }
  .section-heading p { max-width: 280px; }
  .section-heading > .button, .section-heading > .filter-row { display: none; }
  .summary-pill { padding: 8px 10px; font-size: 8px; }
  .worker-task-card { grid-template-columns: 36px 1fr; padding: 14px; }
  .worker-task-card .avatar { width: 36px; height: 36px; align-self: start; }
  .worker-task-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .calendar-panel { overflow-x: auto; }
  .calendar-grid { min-width: 720px; }
  .document-grid, .team-grid { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { width: 100%; max-height: 94vh; border-radius: 20px 20px 0 0; }
  .modal-header { padding: 17px; }
  .modal form { padding: 17px; }
  .task-modal-summary { margin: 15px 17px 0; }
  .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
  .confirmation-checks { grid-template-columns: 1fr; }
  .modal-actions { display: grid; grid-template-columns: 1fr 1.4fr; }
  .upload-preview { grid-template-columns: repeat(3, 1fr); }
  .toast-region { right: 12px; left: 12px; bottom: 78px; }
  .toast { max-width: none; }
}

@media print {
  .sidebar, .topbar, .mobile-bottom-nav, .button, .icon-button { display: none !important; }
  .workspace { margin: 0; padding: 20px; }
  .view { display: none !important; }
  .view[data-view-panel="today"] { display: block !important; }
  .today-layout { grid-template-columns: 1fr 290px; }
  .panel, .worker-task-card { break-inside: avoid; box-shadow: none; }
}
