:root {
  --docomo-red: #c8002f;
  --ink: #20242a;
  --muted: #68707b;
  --line: #d9dee6;
  --panel: #ffffff;
  --paper: #f4f6f9;
  --soft-red: #fff1f4;
  --blue: #0f6fbd;
  --green: #16845b;
  --amber: #9b6400;
  --shadow: 0 10px 30px rgba(22, 31, 46, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

.app-header {
  background:
    linear-gradient(90deg, rgba(200, 0, 47, 0.95), rgba(200, 0, 47, 0.78)),
    #c8002f;
  color: #fff;
}

.header-inner {
  max-width: 1240px;
  min-height: 168px;
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
}

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

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.12;
}

h2 {
  font-size: 18px;
}

.meta {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
}

.visual-meter {
  flex: 0 0 auto;
  width: 180px;
  height: 110px;
  position: relative;
}

.phone-shape {
  position: absolute;
  right: 64px;
  top: 2px;
  width: 74px;
  height: 106px;
  border: 3px solid rgba(255, 255, 255, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 17px;
}

.phone-shape span {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: #fff;
}

.phone-shape span:nth-child(2) {
  width: 72%;
  background: #f7c7d2;
}

.phone-shape span:nth-child(3) {
  width: 48%;
  background: #bde2ff;
}

.signal-bars {
  position: absolute;
  right: 0;
  bottom: 8px;
  display: flex;
  align-items: end;
  gap: 7px;
}

.signal-bars i {
  width: 18px;
  border-radius: 4px 4px 0 0;
  background: #fff;
  display: block;
}

.signal-bars i:nth-child(1) {
  height: 28px;
  background: #ffe2e8;
}

.signal-bars i:nth-child(2) {
  height: 44px;
  background: #fff;
}

.signal-bars i:nth-child(3) {
  height: 64px;
  background: #bde2ff;
}

.signal-bars i:nth-child(4) {
  height: 86px;
  background: #dff5eb;
}

.app-shell {
  max-width: 1240px;
  margin: -36px auto 40px;
  padding: 0 24px;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.summary-band > div {
  min-width: 0;
  background: var(--panel);
  padding: 18px;
}

.summary-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.summary-band strong {
  display: block;
  color: var(--docomo-red);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.1;
  white-space: nowrap;
}

.summary-band small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 22px;
  margin-top: 22px;
  align-items: start;
}

.input-panel,
.result-panel {
  display: grid;
  gap: 16px;
}

.panel-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 1px 0 rgba(22, 31, 46, 0.02);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.one {
  grid-template-columns: minmax(0, 1fr);
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field.wide {
  width: 100%;
}

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

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c9d0da;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
}

input:focus,
select:focus {
  outline: 3px solid rgba(15, 111, 189, 0.18);
  border-color: var(--blue);
}

input:disabled,
select:disabled {
  color: #87909b;
  background: #f0f2f5;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin: 2px 0 14px;
}

.check-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: #343a42;
  font-size: 14px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  accent-color: var(--docomo-red);
}

.ghost-button {
  border: 1px solid #c9d0da;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-height: 36px;
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 700;
}

.ghost-button:hover {
  border-color: var(--docomo-red);
  color: var(--docomo-red);
}

.breakdown {
  margin: 14px 0 0;
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.breakdown div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #fff;
  padding: 11px 12px;
}

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

.breakdown dd {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.device-info {
  margin: -2px 0 14px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  font-size: 13px;
}

.table-wrap {
  margin-top: 14px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 340px;
  background: #fff;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: var(--muted);
  background: #f8fafc;
  font-weight: 800;
}

tr:last-child td {
  border-bottom: 0;
}

td:last-child {
  font-weight: 800;
  white-space: nowrap;
}

.current-row td {
  background: var(--soft-red);
}

.memo-list {
  margin: 14px 0 0;
  padding-left: 18px;
  color: #424952;
  font-size: 13px;
}

.memo-list li + li {
  margin-top: 8px;
}

.amount-positive {
  color: var(--green);
}

.amount-warning {
  color: var(--amber);
}

.hidden {
  display: none !important;
}

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

  .result-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-panel .panel-section:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .header-inner {
    min-height: 144px;
    padding: 22px 16px;
  }

  .visual-meter {
    display: none;
  }

  .app-shell {
    margin-top: -20px;
    padding: 0 12px 28px;
  }

  .summary-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-band > div,
  .panel-section {
    padding: 14px;
  }

  .grid.two,
  .grid.three,
  .result-panel {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
  }
}

@media (max-width: 430px) {
  .summary-band {
    grid-template-columns: 1fr;
  }

  .summary-band strong {
    white-space: normal;
  }

  .section-heading {
    flex-direction: column;
  }

  .ghost-button {
    width: 100%;
  }
}
