:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #617083;
  --line: #d8dee8;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --blue: #2457c5;
  --green: #13795b;
  --amber: #9a6200;
  --red: #b42318;
  --soft-blue: #eaf1ff;
  --soft-green: #e8f6ef;
  --soft-amber: #fff4db;
  --soft-red: #fdeceb;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: inherit; text-decoration: none; }
header {
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.bar {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
}
.brand { font-weight: 750; font-size: 18px; }
nav { display: flex; gap: 8px; flex-wrap: wrap; }
main { max-width: 1280px; margin: 0 auto; padding: 22px 20px 48px; }
.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  font-weight: 650;
  cursor: pointer;
}
.btn.primary, button.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.danger, button.danger { color: var(--red); border-color: #efc6c2; }
.grid { display: grid; gap: 14px; }
.metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 18px; }
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.metric span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.metric strong { display: block; margin-top: 7px; font-size: 24px; }
a.metric-link { text-decoration: none; color: inherit; cursor: pointer; transition: border-color .12s, background .12s, box-shadow .12s; }
a.metric-link:hover { border-color: var(--blue); background: #eef4ff; }
a.metric-link.active { border-color: var(--blue); background: #eef4ff; box-shadow: inset 0 0 0 1px var(--blue); }
a.metric-link.active strong { color: var(--blue); }
#server-list { scroll-margin-top: 84px; }
.toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
.toolbar input { max-width: 320px; }
.toolbar select { max-width: 180px; }
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}
th { background: #f0f3f8; color: #445165; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
h1, h2 { margin: 0 0 14px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.rented { background: var(--soft-blue); color: var(--blue); }
.available { background: var(--soft-green); color: var(--green); }
.maintenance, .reserved { background: var(--soft-amber); color: var(--amber); }
.due, .late { background: var(--soft-red); color: var(--red); }
.soon { background: var(--soft-amber); color: var(--amber); }
.ok { background: var(--soft-green); color: var(--green); }
.none { background: #eef1f5; color: var(--muted); }
.two { grid-template-columns: minmax(0, 1fr) minmax(320px, .45fr); align-items: start; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.compact { grid-template-columns: 1fr; }
label { display: grid; gap: 6px; color: #344054; font-weight: 650; font-size: 13px; }
label.full { grid-column: 1 / -1; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.spec { white-space: pre-line; min-width: 210px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.spaced { margin-top: 14px; }
@media (max-width: 900px) {
  .metrics, .two, .form-grid { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
  .bar { align-items: flex-start; flex-direction: column; }
}

.login-wrap { min-height: 70vh; display: grid; place-items: center; }
.login-panel { width: min(440px, 100%); }
.stack { display: grid; gap: 14px; }
.hint { margin-top: 16px; padding: 12px; background: #f0f3f8; border-radius: 8px; color: var(--muted); line-height: 1.5; }
.user-chip { white-space: nowrap; font-size: 13px; }
.notice { padding: 10px 12px; border-radius: 7px; margin: 0 0 14px; font-weight: 650; }
.notice.danger { background: var(--soft-red); color: var(--red); }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.feature-grid > div { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fbfcff; }
.feature-grid ul { margin: 0; padding-left: 18px; line-height: 1.55; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.inline { display: inline-flex; gap: 6px; margin: 2px; align-items: center; }
.wide-inline { width: min(520px, 100%); }
.wide-inline input { min-width: 160px; }
.big-number { font-size: 52px; font-weight: 800; line-height: 1; margin: 8px 0; }
.owner { background: var(--soft-red); color: var(--red); }
.admin { background: var(--soft-blue); color: var(--blue); }
.customer { background: var(--soft-green); color: var(--green); }
.pending, .open, .waiting { background: var(--soft-amber); color: var(--amber); }
.approved, .resolved, .closed { background: var(--soft-green); color: var(--green); }
.rejected { background: var(--soft-red); color: var(--red); }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }
main.wide { max-width: 1440px; }
@media (max-width: 900px) { .feature-grid { grid-template-columns: 1fr; } .section-head { align-items: flex-start; flex-direction: column; } }

.compact-metrics {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.compact-metrics .metric { padding: 8px 10px; }
.compact-metrics .metric span { font-size: 10px; }
.compact-metrics .metric strong { margin-top: 3px; font-size: 18px; }
.narrow { max-width: 620px; margin-inline: auto; }
.notice.success { background: var(--soft-green); color: var(--green); }
.due-grid { margin-bottom: 14px; }

.overdue-panel { border-color: #efc6c2; background: #fffafa; margin-bottom: 14px; }
.customer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; margin-top: 14px; }
.customer-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: grid; gap: 12px; }
.customer-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.customer-top h2 { margin: 0 0 4px; }
.customer-contact { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 13px; }
.customer-contact span { border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; background: #f8fafc; }
.customer-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.customer-stats div { border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #fbfcff; }
.customer-stats span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.customer-stats strong { display: block; margin-top: 4px; font-size: 16px; }
.assigned-list { display: flex; flex-wrap: wrap; gap: 6px; }
.machine-cell { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.assigned-list.inline { display: inline-flex; }
.mini-link { border: 1px solid var(--line); border-radius: 999px; padding: 5px 8px; background: #fff; font-weight: 650; font-size: 12px; }
@media (max-width: 520px) { .customer-grid { grid-template-columns: 1fr; } }

.metrics { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.history-pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.btn.disabled { opacity: .48; cursor: not-allowed; background: #f4f6f9; }
.inline button { white-space: nowrap; }

.due-grid { grid-template-columns: 1fr; gap: 10px; }
.due-panel { padding: 12px; }
.due-panel .section-head { margin-bottom: 8px; }
.due-panel h2 { margin-bottom: 0; font-size: 18px; }
.ba-cell { line-height: 1.25; white-space: nowrap; }
.ba-cell span { display: block; }
.ba-cell .ba-after { font-weight: 650; }
.ba-cell .ba-arrow { color: var(--muted); font-size: 11px; line-height: 1; }
.ba-cell .ba-before { color: var(--muted); }
.due-detail { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 4px; row-gap: 2px; }
.due-detail strong, .due-detail span { overflow-wrap: anywhere; }
.due-detail .due-sep { color: var(--muted); }
.due-detail .due-amount { font-weight: 700; }
.renter-link { color: var(--blue); font-weight: 750; text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 560px) {
  main { padding: 12px 8px 32px; }
  .due-panel { padding: 10px; border-radius: 7px; }
  .due-panel .section-head { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; }
  .due-panel .section-head h2 { font-size: 16px; }
  .due-panel .section-head .inline { margin: 0; }
  .due-panel .section-head button { min-height: 30px; padding: 5px 8px; font-size: 12px; }
  .due-table { display: table; border: 0; border-radius: 0; background: transparent; }
  .due-table thead { display: none; }
  .due-table tbody, .due-table tr, .due-table td { display: block; width: 100%; }
  .due-table tr { border: 1px solid var(--line); border-radius: 7px; background: #fff; padding: 8px; margin-bottom: 8px; }
  .due-table tr:last-child { margin-bottom: 0; }
  .due-table td { border: 0; padding: 3px 0; font-size: 13px; }
  .due-table td:nth-child(2)::before { content: ''; }
  .due-table td:nth-child(3) { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 6px; }
  .due-table .inline { margin: 0; }
  .due-table button { min-height: 30px; padding: 5px 8px; font-size: 12px; }
  .due-table .empty { padding: 14px; text-align: center; }
}
.lang-toggle { font-weight: 800; min-width: 62px; }

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}
.server-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 10px;
  min-width: 0;
}
.server-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.server-title {
  display: inline-block;
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 3px;
}
.server-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.server-field {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  background: #fbfcff;
  min-width: 0;
}
.server-field.wide { grid-column: 1 / -1; }
.server-field span:first-child {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.server-field strong,
.server-field small {
  display: block;
  overflow-wrap: anywhere;
}
.server-card .spec {
  min-width: 0;
  max-height: 96px;
  overflow: auto;
}

@media (max-width: 560px) {
  .server-grid { grid-template-columns: 1fr; gap: 8px; }
  .server-card { padding: 10px; }
  .server-card-grid { grid-template-columns: 1fr; }
  .server-card-head { align-items: flex-start; }
}

.server-fast-scroll {
  position: fixed;
  top: 154px;
  right: 8px;
  bottom: 18px;
  width: 32px;
  z-index: 25;
  display: flex;
  justify-content: center;
  touch-action: none;
  cursor: grab;
}
.server-fast-scroll::before {
  content: "";
  display: block;
  width: 7px;
  height: 100%;
  border-radius: 999px;
  background: rgba(36, 87, 197, .18);
  border: 1px solid rgba(36, 87, 197, .22);
}
.server-fast-scroll.dragging { cursor: grabbing; }
.server-fast-thumb {
  position: absolute;
  left: 50%;
  top: 0;
  width: 24px;
  height: 42px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: var(--blue);
  border: 2px solid #fff;
  box-shadow: 0 6px 18px rgba(23, 32, 42, .24);
}
.server-fast-label {
  position: fixed;
  right: 48px;
  top: 50%;
  z-index: 26;
  max-width: min(280px, calc(100vw - 82px));
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(23, 32, 42, .25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
  transition: opacity .12s ease;
  overflow-wrap: anywhere;
}
.server-fast-label.show { opacity: .96; }

@media (max-width: 560px) {
  .server-fast-scroll { top: 132px; right: 3px; bottom: 12px; width: 28px; }
  .server-fast-scroll::before { width: 6px; }
  .server-fast-thumb { width: 22px; height: 38px; }
  .server-fast-label { right: 36px; max-width: calc(100vw - 62px); padding: 8px 10px; }
}

.due-tabs { padding: 10px; }
.due-tab-input { position: absolute; opacity: 0; pointer-events: none; }
.due-tab-labels { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 10px; position: sticky; top: 72px; z-index: 4; background: var(--panel); padding-top: 6px; }
.due-tab-label { cursor: pointer; border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; padding: 8px 12px; background: #f8fafc; font-weight: 750; color: var(--muted); }
.due-tab-label span { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; min-height: 20px; margin-left: 6px; border-radius: 999px; background: #e8edf5; color: var(--text); font-size: 12px; }
.due-tab-panel { display: none; padding: 4px 2px 2px; }
#due-tab-overdue:checked ~ .due-tab-labels label[for="due-tab-overdue"],
#due-tab-today:checked ~ .due-tab-labels label[for="due-tab-today"],
#due-tab-tomorrow:checked ~ .due-tab-labels label[for="due-tab-tomorrow"] { background: #fff; color: var(--text); }
#due-tab-overdue:checked ~ .due-tab-panel:nth-of-type(1),
#due-tab-today:checked ~ .due-tab-panel:nth-of-type(2),
#due-tab-tomorrow:checked ~ .due-tab-panel:nth-of-type(3) { display: block; }
.status-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.reminder-inline, .reminder-inline button { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.copy-reminder-button, .copy-qr-button { white-space: nowrap; }
.qr-copy-modal { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 18px; background: rgba(23, 32, 42, .42); }
.qr-copy-modal.show { display: flex; }
.qr-copy-sheet { position: relative; width: min(360px, 100%); background: #fff; border-radius: 8px; padding: 16px; border: 1px solid var(--line); box-shadow: 0 18px 44px rgba(23, 32, 42, .28); text-align: center; }
.qr-copy-sheet img { width: min(260px, 78vw); height: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 8px; }
.qr-copy-sheet p { color: var(--muted); margin: 12px 0 0; line-height: 1.45; }
.qr-copy-close { position: absolute; top: 8px; right: 8px; min-width: 32px; min-height: 32px; padding: 0; }
.qr-thumb { width: 82px; height: 82px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.template-table textarea { min-height: 72px; min-width: 320px; }
.template-table input { min-width: 180px; }
.template-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.qr-assign-table textarea { min-height: 56px; min-width: 220px; }
.qr-assign-table input { min-width: 160px; }
.compact-save { margin-top: 6px; min-height: 30px; padding: 5px 10px; font-size: 12px; }
@media (max-width: 760px) {
  header { position: static; }
  .due-tabs { overflow: visible; }
  .due-tab-labels {
    overflow-x: auto;
    flex-wrap: nowrap;
    top: 0;
    z-index: 20;
    margin: -10px -10px 10px;
    padding: 8px 10px 0;
    box-shadow: 0 8px 18px rgba(23, 32, 42, .08);
  }
  .due-tab-label { white-space: nowrap; }
  .status-actions { align-items: flex-start; }
}

