:root {
  --ink: #17372d;
  --muted: #6d8179;
  --paper: #f3f7f2;
  --surface: #fffef9;
  --line: #dce7df;
  --green: #247a5a;
  --green-dark: #17563f;
  --green-pale: #dcefe5;
  --amber: #f4e2b8;
  --red: #a8473d;
  --shadow: 0 18px 48px rgba(29, 74, 57, .09);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% -15%, rgba(91, 166, 128, .16), transparent 28rem),
    var(--paper);
  font-family: Aptos, "Segoe UI", sans-serif;
  line-height: 1.45;
}
a { color: var(--green-dark); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #72bb99; outline-offset: 3px; }

h1, h2, h3, p { margin-top: 0; }
h1, h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -.035em;
}
h1 { margin-bottom: .4rem; font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1.02; }
h2 { margin-bottom: .35rem; font-size: clamp(1.35rem, 2.5vw, 2rem); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
aside {
  position: sticky; top: 0; height: 100vh; padding: 28px 22px;
  display: flex; flex-direction: column; border-right: 1px solid var(--line);
  background: rgba(255, 254, 249, .72); backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); font: 700 1.15rem Georgia, serif; }
.brand b, .login-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 14px; color: white; background: var(--green); box-shadow: 0 10px 24px rgba(36, 122, 90, .22);
}
aside nav { display: grid; gap: 7px; margin-top: 48px; }
aside nav a, .mobile-nav a {
  display: flex; align-items: center; gap: 12px; min-height: 46px;
  padding: 0 14px; border-radius: 13px; color: #50665e; font-weight: 650;
  transition: color .18s, background .18s, transform .18s;
}
aside nav a:hover { color: var(--green-dark); background: var(--green-pale); transform: translateX(2px); }
aside nav span { width: 22px; text-align: center; font-size: 1.15rem; }
.user-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line); }
.user-box strong, .user-box small { display: block; }
.user-box small { margin-top: 2px; color: var(--muted); }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 50%; cursor: pointer; color: var(--green-dark); background: var(--green-pale); }

main { width: min(1420px, 100%); padding: 52px clamp(24px, 5vw, 76px) 72px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 36px; animation: rise .45s ease both; }
.eyebrow { margin-bottom: 7px; color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.muted { color: var(--muted); }

.primary, .secondary, button.primary {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 18px; border: 1px solid transparent; border-radius: 14px; cursor: pointer;
  font-weight: 750; transition: transform .18s, background .18s, box-shadow .18s;
}
.primary { color: white; background: var(--green); box-shadow: 0 10px 24px rgba(36, 122, 90, .18); }
.primary:hover { background: var(--green-dark); transform: translateY(-1px); }
.secondary { color: var(--green-dark); border-color: var(--line); background: var(--surface); }
.wide { width: 100%; }

.hero-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; animation: rise .5s .05s ease both; }
.shift-card, .request-card {
  min-height: 190px; padding: clamp(24px, 4vw, 38px); border-radius: var(--radius);
}
.shift-card {
  color: #eefaf4; background:
    linear-gradient(125deg, rgba(255,255,255,.08), transparent 42%),
    var(--green-dark);
  box-shadow: var(--shadow);
}
.shift-card .eyebrow, .shift-card .muted { color: #b9d9ca; }
.shift-card h2 { margin: 22px 0 8px; font-size: clamp(2.2rem, 6vw, 4.8rem); }
.shift-card h2 span { color: #7cc29f; }
.request-card { border: 1px solid var(--line); background: rgba(255, 254, 249, .83); }
.request-state { margin: 26px 0; }

.admin-strip {
  margin-top: 18px; padding: 22px 26px; display: flex; align-items: center; justify-content: space-between; gap: 20px;
  border: 1px solid #c7ded1; border-radius: var(--radius); background: #e9f4ed;
}
.admin-strip h2 { margin: 0; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; }
.section-block { margin-top: 54px; animation: rise .5s .1s ease both; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }

.timeline { padding: 0; margin: 0; list-style: none; border-top: 1px solid var(--line); }
.timeline li { display: grid; grid-template-columns: minmax(125px, max-content) 1fr; gap: 24px; align-items: center; padding: 17px 4px; border-bottom: 1px solid var(--line); }
.timeline time { color: var(--green); font-weight: 800; font-variant-numeric: tabular-nums; }
.timeline span { line-height: 1.35; }
.timeline .empty { color: var(--muted); }

.segmented { display: inline-flex; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.segmented a { padding: 8px 14px; border-radius: 10px; color: var(--muted); font-weight: 700; }
.segmented a.active { color: white; background: var(--green); }
.schedule-meta { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 12px; color: var(--muted); }
.date-picker { display: flex; align-items: end; gap: 10px; margin: -18px 0 18px; }
.date-picker label { width: min(230px, 100%); }
.table-scroll { overflow: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
table { border-collapse: separate; border-spacing: 0; width: 100%; }
.schedule-table { min-width: 1000px; font-size: .78rem; }
th, td { padding: 12px; border-right: 1px solid #e8eee9; border-bottom: 1px solid #e8eee9; text-align: left; }
thead th { position: sticky; top: 0; z-index: 2; color: var(--muted); background: #f7faf7; }
.schedule-table th:first-child { position: sticky; left: 0; z-index: 3; min-width: 170px; background: #f7faf7; }
.schedule-table tbody th { color: var(--ink); }
.schedule-table .own-row th { color: var(--green); }
.task { min-width: 84px; min-height: 44px; display: grid; place-items: center; padding: 6px; border-radius: 9px; text-align: center; line-height: 1.15; }
.task.smkt { background: #dcebf8; }
.task.break { background: #dcefe0; color: #245f43; }
.task.tickets { background: #f0dfeb; }
.task.mm { background: #f6e8c7; }
.task.other:not(:empty) { background: #eceee9; }
.task.chat, .task.marinade, .task.status, .task.combined, .task.rest {
  color: #174d78; background: #d8eaf8;
}
.task.marks { color: #e7f4ee; background: #365f54; }
.time-header { cursor: pointer; user-select: none; transition: background .25s, color .25s; }
.schedule-table [data-time] { transition: background-color .35s ease, box-shadow .35s ease; }
.schedule-table [data-time].time-highlight {
  background-color: #dff2e7 !important;
  box-shadow: inset 2px 0 #52a67d, inset -2px 0 #52a67d;
}
.schedule-table th.time-highlight { color: var(--green-dark); background: #cdebd9 !important; }
.group-separator th {
  position: static !important; padding: 10px 14px; color: var(--green-dark);
  background: #e8f2eb !important; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
}
.empty-cell { padding: 48px; text-align: center; color: var(--muted); }

.form-panel {
  display: grid; grid-template-columns: minmax(220px, .7fr) 1.5fr; gap: 36px;
  padding: clamp(24px, 4vw, 38px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.request-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: end; }
label { display: grid; gap: 7px; color: #4d625a; font-size: .84rem; font-weight: 700; }
.field-note { color: var(--muted); font-size: .78rem; font-weight: 600; line-height: 1.35; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; color: var(--ink);
  border: 1px solid #cad8cf; border-radius: 11px; background: white;
}
textarea { resize: vertical; }
.full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 9px; }
.check input { width: 18px; min-height: 18px; }

.request-list, .user-list { margin-top: 28px; }
.request-row, .user-row {
  display: grid; align-items: center; gap: 18px; padding: 18px 4px; border-bottom: 1px solid var(--line);
}
.request-row { grid-template-columns: 150px 1fr 100px auto; }
.request-row p, .user-row span { margin: 3px 0 0; color: var(--muted); }
.request-date strong, .request-date span { display: block; }
.user-row { grid-template-columns: 48px 1fr 90px 110px auto minmax(210px, auto); }
.avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; color: var(--green-dark); background: var(--green-pale); font: 700 1.1rem Georgia, serif; }
.role { font-size: .8rem; font-weight: 750; }
.status { display: inline-flex; width: fit-content; padding: 6px 10px; border-radius: 99px; font-size: .74rem; font-weight: 800; }
.status.new { color: #7c5a0b; background: var(--amber); }
.status.accepted { color: #1f6849; background: var(--green-pale); }
.status.rejected { color: #8d342c; background: #f3d8d5; }
.status.cancelled, .status.neutral { color: #66756f; background: #e7ebe8; }
.small, .text-button { border: 0; cursor: pointer; font-weight: 750; }
.small { padding: 7px 10px; border-radius: 9px; }
.accept { color: #1f6849; background: var(--green-pale); }
.reject { color: #8d342c; background: #f3d8d5; }
.text-button { color: var(--green-dark); background: transparent; }
.text-button.danger { color: #9b3229; }
.reset-form, .edit-request form { display: flex; align-items: center; gap: 7px; }
.reset-form input { min-height: 36px; padding: 7px 9px; }
.edit-request summary { cursor: pointer; color: var(--green-dark); font-weight: 750; }
.edit-request form { margin-top: 8px; flex-wrap: wrap; }
.edit-request input { width: auto; min-height: 36px; }
.audit-table { min-width: 740px; }
.audit-table th { color: var(--muted); background: #f7faf7; }
.stats-summary {
  display: grid; grid-template-columns: 1.25fr repeat(3, 1fr); gap: 14px;
  animation: rise .5s .04s ease both;
}
.stat-card {
  min-height: 150px; padding: 24px; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 20px; background: var(--surface);
}
.stat-card span { color: var(--muted); font-size: .8rem; font-weight: 750; }
.stat-card strong {
  margin: auto 0 3px; font: 500 clamp(2.2rem, 4vw, 3.4rem) Georgia, serif;
  letter-spacing: -.04em;
}
.stat-card small { color: var(--muted); }
.primary-stat { color: white; border-color: var(--green-dark); background: var(--green-dark); }
.primary-stat span, .primary-stat small { color: #bfdbce; }
.stats-section { margin-top: 42px; }
.stats-table { min-width: 990px; }
.stats-table thead th { color: var(--muted); background: #f7faf7; font-size: .75rem; }
.stats-table tbody th { min-width: 210px; }
.stats-table .number { text-align: center; font-variant-numeric: tabular-nums; font-weight: 750; }
.stats-table .chat-number { color: #1f6f96; }
.stats-table .rest-number { color: #6e7d76; }
.stats-table .total-number { color: var(--green-dark); font-size: 1rem; }
.activity-track { width: 100%; height: 3px; margin-top: 8px; overflow: hidden; border-radius: 9px; background: #e6ece8; }
.activity-track span { height: 100%; display: block; border-radius: inherit; background: #79b99a; }
.balance { display: inline-flex; padding: 6px 9px; border-radius: 99px; font-size: .72rem; font-weight: 800; white-space: nowrap; }
.balance.even { color: #236448; background: #dcefe5; }
.balance.chat-heavy { color: #225f82; background: #d9eaf4; }
.balance.nonchat-heavy { color: #805e18; background: #f3e7c7; }
.tools-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tool-card {
  min-height: 440px; padding: 26px; display: flex; flex-direction: column; gap: 22px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.tool-card:hover, .tool-card.active {
  border-color: #9bc7b0; box-shadow: var(--shadow); transform: translateY(-2px);
}
.tool-symbol {
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px;
  color: var(--green-dark); background: var(--green-pale); font: 700 .9rem Georgia, serif;
}
.tool-form { display: grid; gap: 13px; margin-top: auto; }
.time-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tool-result {
  margin-top: 28px; padding: clamp(22px, 4vw, 36px); border-radius: var(--radius);
  color: #e8f5ee; background: var(--green-dark); box-shadow: var(--shadow);
  animation: rise .4s ease both;
}
.tool-result .eyebrow { color: #a9d3bf; }
.tool-result h2 { margin: 0; }
.tool-result-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.copy-output {
  width: 100%; min-height: 260px; margin: 24px 0 0; padding: 22px 0 0;
  overflow: auto; resize: vertical; border: 0; border-top: 1px solid rgba(255,255,255,.16);
  border-radius: 0; outline: 0; color: inherit; background: transparent;
  font: 500 .95rem/1.7 Consolas, monospace; white-space: pre-wrap;
}
.copy-button.copied { color: white; border-color: #6eb68f; background: #2f8e68; }
.empty-state { display: grid; place-items: center; gap: 4px; padding: 55px; color: var(--muted); }

.alert { margin-bottom: 18px; padding: 13px 16px; border-radius: 12px; font-weight: 650; }
.alert.success { color: #1f6849; background: var(--green-pale); }
.alert.error { color: #8d342c; background: #f3d8d5; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-shell main { width: 100%; padding: 0; }
.login-panel {
  width: min(470px, 100%); margin: auto; padding: clamp(30px, 7vw, 58px);
  border: 1px solid var(--line); border-radius: 30px; background: rgba(255, 254, 249, .88);
  box-shadow: var(--shadow); animation: rise .45s ease both;
}
.login-panel .login-mark { margin-bottom: 38px; }
.login-panel h1 { font-size: clamp(2.3rem, 8vw, 3.7rem); }
.login-panel.compact { margin-top: 6vh; }
.form-stack { display: grid; gap: 16px; margin-top: 32px; }
.mobile-nav { display: none; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media (max-width: 840px) {
  .app-shell { display: block; }
  aside { display: none; }
  main { padding: 28px 18px 100px; }
  .mobile-nav {
    position: fixed; z-index: 20; left: 12px; right: 12px; bottom: 10px;
    display: flex; justify-content: space-around; padding: 7px;
    border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 254, 249, .94);
    box-shadow: 0 14px 40px rgba(28, 67, 52, .18); backdrop-filter: blur(18px);
  }
  .mobile-nav a { min-height: 48px; padding: 4px 10px; flex-direction: column; gap: 1px; font-size: .65rem; }
  .mobile-nav a span { font-size: 1rem; }
  .page-head { align-items: flex-start; }
  .page-head > .primary { display: none; }
  .hero-grid { grid-template-columns: 1fr; }
  .stats-summary { grid-template-columns: 1fr 1fr; }
  .tools-grid { grid-template-columns: 1fr; }
  .tool-card { min-height: auto; }
  .shift-card, .request-card { min-height: auto; }
  .admin-strip, .section-title, .schedule-meta { align-items: flex-start; flex-direction: column; }
  .date-picker { margin-top: 0; }
  .form-panel { grid-template-columns: 1fr; gap: 20px; }
  .request-form { grid-template-columns: 1fr 1fr; }
  .request-form label:first-of-type, .request-form .full, .request-form button { grid-column: 1 / -1; }
  .request-row { grid-template-columns: 1fr auto; }
  .request-row > :nth-child(2), .request-row > :last-child { grid-column: 1 / -1; }
  .user-row { grid-template-columns: 44px 1fr auto; }
  .user-row > :nth-child(n+4) { grid-column: 2 / -1; }
  .reset-form { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  h1 { font-size: 2.25rem; }
  .page-head { margin-bottom: 24px; }
  .segmented { width: 100%; }
  .segmented a { flex: 1; text-align: center; }
  .request-form { grid-template-columns: 1fr; }
  .request-form > * { grid-column: 1 !important; }
  .login-panel { padding: 32px 24px; border-radius: 24px; }
  .stats-summary { grid-template-columns: 1fr; }
  .stat-card { min-height: 125px; }
}
