:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #edf4ef;
  --ink: #202522;
  --muted: #637069;
  --line: #d9dfd9;
  --accent: #176b5d;
  --accent-2: #c57b2c;
  --danger: #b34040;
  --info: #315f9a;
  --shadow: 0 10px 28px rgba(31, 40, 35, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

.app-frame {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 244, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

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

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.app {
  flex: 1;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

.site-footer {
  width: min(1240px, calc(100% - 32px));
  margin: auto auto 0;
  padding: 18px 0 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.start-grid,
.dashboard-grid,
.two-col,
.three-col {
  display: grid;
  gap: 16px;
}

.start-grid {
  grid-template-columns: minmax(280px, 0.85fr) minmax(300px, 1.15fr);
  align-items: stretch;
}

.dashboard-grid {
  grid-template-columns: minmax(280px, 0.72fr) minmax(360px, 1.28fr);
  align-items: start;
}

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

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

.panel,
.item,
.stat,
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.panel.compact {
  padding: 14px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h1,
.panel-header h2,
.panel-header h3,
.section-title {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

h3,
.section-title {
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: 0;
}

p {
  line-height: 1.55;
}

.lead {
  max-width: 64ch;
  color: var(--muted);
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.stack {
  display: grid;
  gap: 12px;
}

.stack-lg {
  display: grid;
  gap: 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button,
button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.button.primary,
button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button.warn,
button.warn {
  border-color: #e7c9a7;
  background: #fff7ed;
  color: #7a4516;
}

.button.danger,
button.danger {
  border-color: #f0b8b8;
  background: #fff2f2;
  color: var(--danger);
}

.button.ghost,
button.ghost {
  background: transparent;
}

.button:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

form {
  display: grid;
  gap: 12px;
}

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

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

textarea {
  min-height: 92px;
  resize: vertical;
}

.checkbox-row,
.branch-grid {
  display: grid;
  gap: 8px;
}

.branch-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 260px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.check input {
  width: 16px;
  min-height: 16px;
}

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

.item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.item-title {
  margin: 0;
  font-size: 17px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--surface-2);
  color: #2c4f46;
  font-size: 12px;
  font-weight: 800;
}

.badge.info {
  background: #edf4ff;
  color: var(--info);
}

.badge.warn {
  background: #fff1dd;
  color: #885117;
}

.badge.danger {
  background: #fff0f0;
  color: var(--danger);
}

.stat {
  padding: 14px;
}

.stat strong {
  display: block;
  font-size: 26px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.notice {
  padding: 12px 14px;
  border-color: #d6e5dc;
  background: #f7fbf8;
  color: #2e4d43;
}

.error {
  border-color: #f0b8b8;
  background: #fff5f5;
  color: var(--danger);
}

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

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

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

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

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

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 6px 0;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
}

@media (max-width: 920px) {
  .start-grid,
  .dashboard-grid,
  .two-col,
  .three-col {
    grid-template-columns: 1fr;
  }

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

  .nav {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .app {
    width: min(100% - 20px, 1240px);
    padding-top: 18px;
  }

  .branch-grid {
    grid-template-columns: 1fr;
  }

  .item-head,
  .panel-header {
    display: grid;
  }
}
