:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --sidebar: #eef1f6;
  --line: #d8dde8;
  --text: #182033;
  --muted: #6b7280;
  --accent: #2477d4;
  --accent-soft: #e7f1ff;
  --danger: #bf3434;
  --success: #167d4f;
  font-family: Inter, "Segoe UI", "Yu Gothic UI", "Meiryo", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 28px 30px 40px;
  overflow: auto;
}

.sidebar section {
  padding: 0 0 24px;
  margin: 0 0 24px;
  border-bottom: 1px solid var(--line);
}

.sidebar section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
}

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

h1 {
  font-size: 42px;
  line-height: 1.2;
  font-weight: 800;
}

h2 {
  font-size: 20px;
  line-height: 1.35;
  font-weight: 760;
  margin-bottom: 16px;
}

.main {
  padding: 78px min(6vw, 72px) 56px;
  overflow-x: hidden;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
}

.app-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 70% 28%, #fff 0 7%, transparent 8%),
    radial-gradient(circle at 58% 18%, rgba(255, 255, 255, .85) 0 5%, transparent 6%),
    linear-gradient(135deg, #2d66df 0 46%, transparent 47%),
    linear-gradient(160deg, #79cdf5 0 100%);
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  margin: 0 0 16px;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

.input-grid input {
  background: #eef1f6;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(36, 119, 212, .16);
}

textarea {
  resize: vertical;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
}

button:hover {
  border-color: #b9c1d2;
}

button.primary {
  width: 100%;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

button.danger {
  border-color: rgba(191, 52, 52, .35);
  color: var(--danger);
}

.calculator {
  padding-bottom: 36px;
  border-bottom: 1px solid var(--line);
}

.calculator h2 {
  font-size: 27px;
  margin-bottom: 20px;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 28px 72px;
  max-width: 760px;
}

.metric {
  display: grid;
  gap: 6px;
}

.metric span {
  color: var(--text);
  font-size: 15px;
}

.metric strong {
  font-size: 32px;
  line-height: 1.15;
  font-weight: 520;
}

.data-section {
  padding-top: 44px;
}

.data-section > h2 {
  font-size: 28px;
}

.table-groups {
  display: grid;
  gap: 30px;
}

.table-block h3 {
  font-size: 16px;
  margin: 0 0 12px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #e7eaf1;
  text-align: left;
  font-size: 14px;
}

th {
  background: #f7f8fb;
  color: #7a8394;
  font-weight: 700;
}

td:first-child,
th:first-child {
  text-align: right;
  width: 110px;
}

tr.summary-row td {
  background: var(--accent-soft);
  font-weight: 760;
}

.status-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  line-height: 1.55;
}

.status-block.accent {
  background: #edf8f2;
  border-color: rgba(22, 125, 79, .26);
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.muted,
.empty {
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #192132;
  color: #fff;
  box-shadow: 0 14px 34px rgba(24, 32, 51, .22);
  z-index: 50;
}

.toast.error {
  background: var(--danger);
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main {
    padding: 36px 20px 48px;
  }

  h1 {
    font-size: 32px;
  }

  .input-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }
}
