@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700&family=Literata:ital,wght@0,500;0,600;0,700;1,500&display=swap');

:root {
  --forest: #173f2a;
  --forest-2: #2f7050;
  --gold: #c99b40;
  --paper: #fbf5dc;
  --paper-2: #eee0b3;
  --ink: #233426;
  --soft: #647064;
  --line: rgba(97, 83, 40, .24);
  --danger: #a64e35;
  --shadow: 0 16px 42px rgba(31, 50, 30, .17);
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #e5dfc2; }
button, input, textarea { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(201,155,64,.7); outline-offset: 2px; }

.admin-app { min-width: 1100px; min-height: 100vh; background: radial-gradient(circle at 85% 0, rgba(236,210,123,.32), transparent 28%), linear-gradient(180deg, #f6f0d7, #dfe4cb); }
.admin-header { min-height: 94px; display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; padding: 12px 28px; border-bottom: 3px solid rgba(47,112,80,.34); background: linear-gradient(180deg, #fffbed, #eadcad); box-shadow: 0 8px 24px rgba(40,53,31,.12); }
.back-home { min-height: 42px; display: inline-flex; align-items: center; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--forest); background: rgba(255,255,247,.72); font-weight: 700; text-decoration: none; }
.admin-identity { display: flex; align-items: center; gap: 14px; }
.admin-seal { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 50%; border: 2px solid #d3a946; color: #f7dda0; font-size: 27px; background: radial-gradient(circle, #3a805b, #163f2a 67%, #d2a64d 68% 74%, #173f2a 75%); box-shadow: inset 0 0 0 2px #edd078, 0 5px 14px rgba(26,58,35,.23); }
.admin-identity small, .admin-identity strong, .admin-identity em { display: block; }
.admin-identity small { color: #8b682a; font-weight: 700; letter-spacing: 1px; }
.admin-identity strong { margin-top: 2px; font-family: 'Literata', serif; font-size: 27px; color: var(--forest); }
.admin-identity em { margin-top: 3px; color: #675e43; font-family: 'Literata', serif; font-size: 11px; }
.admin-state { display: flex; align-items: stretch; gap: 8px; }
.admin-state span { min-width: 120px; display: grid; align-content: center; padding: 7px 11px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,248,.68); }
.admin-state small, .admin-state strong { display: block; }
.admin-state small { color: var(--soft); font-size: 8px; }
.admin-state strong { margin-top: 2px; font-family: 'Literata', serif; color: var(--forest); }
.admin-state a { display: inline-flex; align-items: center; padding: 0 13px; border: 1px solid #c99b40; border-radius: 10px; color: #fff2ba; background: linear-gradient(180deg,#347553,#17412c); text-decoration: none; font-weight: 700; font-size: 10px; }

.admin-main { display: grid; grid-template-columns: 250px minmax(0,1fr); min-height: calc(100vh - 94px); }
.admin-sidebar { padding: 18px 13px; border-right: 1px solid rgba(79,82,48,.24); background: linear-gradient(180deg, rgba(252,246,221,.95), rgba(231,220,181,.94)); }
.sidebar-heading { padding: 7px 11px 13px; border-bottom: 1px solid var(--line); }
.sidebar-heading strong, .sidebar-heading small { display: block; }
.sidebar-heading strong { font-family: 'Literata', serif; color: var(--forest); }
.sidebar-heading small { margin-top: 3px; color: var(--soft); font-size: 8px; }
.admin-nav { width: 100%; min-height: 44px; margin-top: 5px; padding: 0 12px; border: 0; border-radius: 9px; text-align: left; color: #425044; background: transparent; cursor: pointer; font-weight: 600; }
.admin-nav:hover, .admin-nav.active { color: #ffeaa4; background: linear-gradient(180deg,#347553,#17412c); box-shadow: inset 0 0 0 1px #d0a94a; }
.sidebar-note { margin-top: 17px; padding: 12px; border: 1px solid rgba(142,104,30,.22); border-radius: 12px; background: rgba(255,248,219,.7); }
.sidebar-note strong { font-family: 'Literata', serif; color: var(--forest); font-size: 11px; }
.sidebar-note p { margin: 7px 0 0; color: var(--soft); font-size: 8px; line-height: 1.55; }

.admin-content { min-width: 0; padding: 18px 22px 100px; position: relative; }
.status-banner { min-height: 66px; display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; border: 1px solid rgba(47,112,80,.24); border-radius: 13px; background: rgba(242,244,214,.9); box-shadow: 0 8px 24px rgba(38,54,31,.08); }
.status-banner > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--forest-2); font-weight: 700; }
.status-banner strong, .status-banner p { display: block; margin: 0; }
.status-banner strong { font-family: 'Literata', serif; color: var(--forest); }
.status-banner p { margin-top: 3px; color: var(--soft); font-size: 9px; }
.status-banner button, .section-title button { min-height: 36px; padding: 0 11px; border: 1px solid rgba(116,90,31,.25); border-radius: 8px; color: var(--forest); background: #f4e8b9; cursor: pointer; font-weight: 700; font-size: 9px; }
.status-banner.changed { border-color: rgba(184,116,44,.35); background: #fff0d7; }
.status-banner.changed > span { background: #b66e39; }

.admin-section { display: none; margin-top: 15px; }
.admin-section.active { display: block; }
.section-title { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 15px; border: 1px solid rgba(82,80,43,.24); border-radius: 14px 14px 0 0; color: #f7e6aa; background: linear-gradient(180deg,#347553,#17412c); }
.section-title small, .section-title strong { display: block; }
.section-title small { opacity: .82; font-size: 8px; }
.section-title strong { margin-top: 2px; font-family: 'Literata', serif; font-size: 16px; }
.section-title button { color: #f7e6aa; border-color: rgba(255,255,255,.24); background: rgba(255,255,255,.08); }

.overview-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-top: 12px; }
.overview-cards article { min-height: 115px; display: grid; align-content: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(251,247,229,.94); box-shadow: var(--shadow); }
.overview-cards small, .overview-cards strong, .overview-cards em { display: block; }
.overview-cards small { color: #8a682d; font-weight: 700; font-size: 8px; }
.overview-cards strong { margin-top: 6px; font-family: 'Literata', serif; color: var(--forest); font-size: 27px; }
.overview-cards em { margin-top: 4px; color: var(--soft); font-size: 8px; }
.overview-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.panel { border: 1px solid var(--line); border-radius: 14px; background: rgba(251,247,229,.94); box-shadow: var(--shadow); overflow: hidden; }
.panel-heading { min-height: 43px; display: flex; align-items: center; padding: 0 13px; color: #f7e4a7; background: linear-gradient(180deg,#337350,#17412c); }
.panel-heading strong { font-family: 'Literata', serif; }
.panel ul { margin: 0; padding: 13px 18px 16px 37px; }
.panel li { padding: 6px 0; color: #4d5a4e; font-size: 9px; line-height: 1.5; }
.activity-log { min-height: 220px; }
#activity-log { padding: 13px; color: var(--soft); font-size: 9px; }
#activity-log p { margin: 0 0 7px; padding-bottom: 7px; border-bottom: 1px solid rgba(78,82,48,.12); }

.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding: 16px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 14px 14px; background: rgba(251,247,229,.95); box-shadow: var(--shadow); }
.form-grid label, .json-preview { display: grid; gap: 6px; }
.form-grid label.wide { grid-column: 1/-1; }
.form-grid label > span, .json-preview > span { color: #4c594d; font-size: 9px; font-weight: 700; }
.form-grid input, .repeat-card input, .json-preview textarea { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid rgba(85,85,50,.24); border-radius: 8px; color: var(--ink); background: rgba(255,255,251,.78); }
.check-label { grid-template-columns: auto 1fr; align-items: center; }
.check-label input { width: 20px; min-height: 20px; }
.metrics-form { grid-template-columns: repeat(3,1fr); }
.data-warning { display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: center; margin-top: 11px; padding: 11px 13px; border: 1px solid rgba(169,90,53,.28); border-radius: 12px; background: #fff0e2; }
.data-warning > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--danger); font-weight: 700; }
.data-warning p { margin: 0; color: #745447; font-size: 9px; line-height: 1.5; }

.repeat-list { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 14px 14px; background: rgba(251,247,229,.95); box-shadow: var(--shadow); }
.repeat-card { display: grid; grid-template-columns: 60px 1fr 1.5fr; gap: 10px; align-items: end; padding: 12px; border: 1px solid rgba(82,83,48,.15); border-radius: 11px; background: rgba(255,255,250,.68); }
.repeat-card label { display: grid; gap: 5px; }
.repeat-card label span { color: var(--soft); font-size: 8px; font-weight: 700; }

.data-actions { display: flex; gap: 10px; padding: 16px; border: 1px solid var(--line); border-top: 0; background: rgba(251,247,229,.95); }
.data-actions button, .file-button { min-height: 40px; display: inline-flex; align-items: center; padding: 0 13px; border: 1px solid rgba(84,83,46,.25); border-radius: 9px; color: var(--forest); background: #f2e6b5; cursor: pointer; font-weight: 700; font-size: 9px; }
.data-actions .danger { color: white; background: var(--danger); }
.file-button input { display: none; }
.json-preview { padding: 0 16px 16px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 14px 14px; background: rgba(251,247,229,.95); }
.json-preview textarea { min-height: 330px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; }

.admin-footer { position: fixed; left: 250px; right: 0; bottom: 0; z-index: 30; min-height: 72px; display: grid; grid-template-columns: 1fr auto auto; gap: 9px; align-items: center; padding: 10px 22px; border-top: 1px solid rgba(91,75,32,.34); background: rgba(255,249,224,.97); box-shadow: 0 -10px 28px rgba(39,52,31,.13); }
.admin-footer strong, .admin-footer small { display: block; }
.admin-footer strong { color: var(--forest); }
.admin-footer small { margin-top: 3px; color: var(--soft); font-size: 8px; }
.admin-footer button { min-height: 42px; padding: 0 15px; border: 1px solid rgba(83,79,42,.24); border-radius: 9px; color: var(--forest); background: #efe2ae; cursor: pointer; font-weight: 700; }
.admin-footer .primary { color: #fff0b5; border-color: #d0a342; background: linear-gradient(180deg,#347553,#17412c); }

@media (max-width: 1250px) {
  .admin-app { min-width: 1000px; }
  .admin-header { grid-template-columns: auto 1fr; }
  .admin-state { grid-column: 1/-1; justify-content: flex-end; margin-top: -6px; }
  .overview-cards { grid-template-columns: repeat(2,1fr); }
}
