:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --ink: #172033;
  --muted: #667085;
  --line: #d8e0ea;
  --panel: #ffffff;
  --blue: #1f6feb;
  --blue-soft: #eaf2ff;
  --amber: #b7791f;
  --amber-soft: #fff5da;
  --green: #16803c;
  --green-soft: #eaf7ef;
  --red: #b42318;
  --red-soft: #fdecec;
  --slate: #203040;
  --shadow: 0 16px 40px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

[hidden] {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1360px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.login-view {
  display: grid;
  min-height: 90vh;
  place-items: center;
}

.login-panel {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-weight: 700;
}

.session-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-box div {
  display: grid;
  gap: 2px;
  min-width: 140px;
  text-align: right;
}

.session-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.filters {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 16px;
}

.date-box {
  display: grid;
  gap: 6px;
  min-width: 190px;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 8px 10px;
}

input:focus,
select:focus {
  border-color: var(--blue);
  outline: 2px solid rgba(31, 111, 235, 0.14);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.status-message {
  min-height: 0;
  margin-bottom: 0;
  overflow: hidden;
  border-radius: 8px;
  font-weight: 700;
  transition: min-height 0.18s ease, margin-bottom 0.18s ease, padding 0.18s ease;
}

.status-message:not(:empty) {
  min-height: 42px;
  margin-bottom: 14px;
  padding: 11px 14px;
  border: 1px solid #b7dfc2;
  background: var(--green-soft);
  color: var(--green);
}

.status-message[data-type="error"]:not(:empty) {
  border-color: #f1b8b4;
  background: var(--red-soft);
  color: var(--red);
}

.metrics article,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics article {
  padding: 14px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.bottom-grid {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 14px;
  margin-top: 14px;
}

.panel {
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  padding: 12px 14px;
  background: var(--blue);
  color: #ffffff;
}

.panel-head.warm {
  background: var(--amber);
}

.panel-head.green {
  background: var(--green);
}

.panel-head.slate {
  background: var(--slate);
}

.panel-head span {
  min-width: 34px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  padding: 5px 10px;
  text-align: center;
  font-weight: 700;
}

.entry-form {
  display: grid;
  grid-template-columns: 140px minmax(120px, 1fr) 120px auto;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.platform-sections {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.platform-block {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.platform-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
}

.platform-title h3 {
  margin: 0 0 4px;
  font-size: 15px;
  letter-spacing: 0;
}

.platform-title span,
.platform-totals span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.platform-totals {
  text-align: right;
}

.platform-totals strong {
  display: block;
  margin-bottom: 4px;
  font-size: 18px;
}

.platform-form {
  grid-template-columns: minmax(130px, 1fr) 110px auto;
  padding: 12px;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--slate);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  padding: 8px 13px;
}

button:hover {
  filter: brightness(1.06);
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.8);
  opacity: 0.55;
}

.ghost {
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.15);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.compact-table {
  min-width: 560px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td.money,
td.rate,
td.actions {
  text-align: right;
}

.delete-btn {
  min-height: 30px;
  background: var(--red-soft);
  color: var(--red);
  padding: 4px 9px;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.positive {
  color: var(--green);
  font-weight: 700;
}

.negative {
  color: var(--red);
  font-weight: 700;
}

.settings {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pager span {
  min-width: 70px;
  text-align: center;
  font-weight: 700;
}

.user-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.user-form button {
  grid-column: 1 / -1;
}

.role-help {
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
  border-bottom: 1px solid var(--line);
}

.role-help div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 10px 12px;
}

.role-help strong {
  font-size: 13px;
}

.role-help span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.closing-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.closing-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
}

.closing-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.closing-summary strong {
  display: block;
  margin-top: 7px;
  font-size: 20px;
}

.accounting-note {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.accounting-note p {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
  line-height: 1.45;
}

.setting-row {
  display: grid;
  grid-template-columns: 1fr 86px 86px 108px;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.setting-row strong {
  display: block;
  margin-bottom: 6px;
}

.setting-row span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 980px) {
  .metrics,
  .workspace,
  .bottom-grid,
  .closing-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 18px, 1360px);
    padding-top: 12px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .entry-form,
  .setting-row,
  .filters,
  .user-form {
    grid-template-columns: 1fr;
  }

  .session-box {
    justify-content: space-between;
  }

  .session-box div {
    text-align: left;
  }

  .metrics strong {
    font-size: 21px;
  }
}
