:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #17191f;
  --muted: #69707d;
  --line: #dfe3ea;
  --accent: #0870c8;
  --accent-dark: #075a9f;
  --good: #117a47;
  --warn: #9a5b00;
  --shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  line-height: 1.6;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-panel {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-panel h1 {
  margin: 0 0 8px;
}

.login-panel p {
  color: var(--muted);
}

.login-panel label {
  margin-top: 18px;
}

.login-panel button {
  width: 100%;
  margin-top: 16px;
}

.compact-brand {
  color: var(--ink);
  margin-bottom: 24px;
}

.compact-brand .brand-sub {
  color: var(--muted);
}

.dev-link-wrap {
  margin-bottom: 0;
}

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

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

.sidebar {
  background: #151922;
  color: #fff;
  padding: 24px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 32px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--accent);
  border-radius: 8px;
  font-weight: 800;
}

.brand-name,
.brand-sub,
.topbar p,
.panel p {
  margin: 0;
}

.brand-name {
  font-weight: 800;
}

.brand-sub {
  color: #aab2c0;
  font-size: 12px;
}

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

.nav a {
  color: #d8deea;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
}

.nav a:hover,
.nav a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.nav-support {
  margin-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 16px;
}

.workspace {
  padding: 28px;
  display: grid;
  gap: 20px;
}

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

.topbar {
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
}

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

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

.topbar p,
.panel p {
  color: var(--muted);
  font-size: 14px;
}

.context-form,
.timer-form {
  display: grid;
  gap: 12px;
}

.context-form {
  grid-template-columns: 150px 180px auto;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 9px 10px;
  background: #fff;
}

button,
.button-link {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  font-weight: 700;
}

button:hover,
.button-link:hover {
  background: var(--accent-dark);
}

button:disabled {
  background: #b9c3d0;
  cursor: not-allowed;
}

.secondary-button {
  background: #e8eef6;
  color: #172033;
}

.secondary-button:hover {
  background: #d8e2ef;
}

.danger-button {
  background: #f4e7e7;
  color: #8a1f1f;
}

.danger-button:hover {
  background: #ecd2d2;
}

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

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

.workflow-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 4px 12px;
  align-items: center;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
}

.workflow-step:hover {
  border-color: #b9d1ea;
}

.workflow-step span {
  grid-row: 1 / span 2;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e8eef6;
  color: var(--accent-dark);
  font-weight: 800;
}

.workflow-step strong {
  font-size: 15px;
}

.workflow-step small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.metric {
  padding: 18px;
}

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

.metric strong {
  display: block;
  font-size: 28px;
  margin-top: 4px;
}

.panel {
  padding: 20px;
}

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

.timer-display {
  min-width: 140px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 28px;
  font-weight: 800;
  text-align: right;
}

.timer-form {
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.5fr);
}

.timer-form label:last-child,
.wide-field {
  grid-column: 1 / -1;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.status-text {
  margin-top: 12px;
  color: var(--good);
  font-weight: 700;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f3f6fa;
  font-weight: 800;
}

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

.export-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px auto;
  gap: 18px;
  align-items: end;
}

.export-month {
  min-width: 0;
}

.compact-context {
  grid-template-columns: 160px 140px auto;
}

.review-rows {
  display: grid;
  gap: 14px;
}

.review-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfe;
}

.review-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.review-card h3,
.review-meta,
.empty-text {
  margin: 0;
}

.review-card h3 {
  font-size: 16px;
}

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

.empty-state {
  border: 1px dashed #c9d3df;
  border-radius: 8px;
  background: #f8fafc;
  padding: 16px;
}

.empty-state strong {
  display: block;
  font-size: 14px;
}

.empty-state p {
  margin-top: 4px;
}

.status-pill {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: #fff;
  color: #384151;
  font-size: 12px;
  font-weight: 800;
}

.error-text {
  color: #9a3412;
}

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

.detail-grid div,
.note-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.detail-grid dt,
.note-box strong {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
}

.detail-grid dd,
.note-box p {
  margin: 4px 0 0;
}

.note-box {
  margin-bottom: 14px;
}

.close-result {
  margin-top: 16px;
}

.close-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.close-metric {
  box-shadow: none;
  padding: 14px;
}

.close-metric strong {
  font-size: 20px;
}

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

  .sidebar {
    position: static;
  }

  .topbar,
  .context-form,
  .summary-grid,
  .workflow-grid,
  .timer-form,
  .form-grid,
  .detail-grid,
  .close-grid,
  .export-panel {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .export-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .timer-display {
    text-align: left;
  }
}
