@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: #153d28;
  --forest-2: #2d6c49;
  --forest-3: #3f805a;
  --gold: #c99b3d;
  --gold-light: #edd787;
  --paper: #fbf5dc;
  --paper-2: #eee0b2;
  --paper-3: #fffbea;
  --ink: #243629;
  --muted: #667066;
  --line: rgba(92, 78, 39, 0.22);
  --success: #3a7b50;
  --warning: #b07835;
  --danger: #a6533e;
  --blue: #477387;
  --shadow: 0 16px 42px rgba(31, 49, 30, 0.16);
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #ddd5ad; }
body { min-width: 1100px; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(201, 155, 61, 0.62); outline-offset: 2px; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.hq-app {
  min-height: 100vh;
  background:
    radial-gradient(circle at 86% -10%, rgba(236, 205, 112, 0.33), transparent 31%),
    linear-gradient(180deg, #f4edd0 0, #e2e4c7 54%, #d9d3ab 100%);
}

.hq-header {
  min-height: 92px;
  display: grid;
  grid-template-columns: auto minmax(500px, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 11px 26px;
  border-bottom: 3px solid rgba(45, 108, 73, 0.35);
  background:
    repeating-linear-gradient(2deg, transparent 0 12px, rgba(117, 83, 24, 0.025) 13px),
    linear-gradient(180deg, #fffbed, #eadbad);
  box-shadow: 0 8px 24px rgba(43, 50, 29, 0.14);
}

.back-map,
.hq-header-actions a,
.hq-header-actions button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid rgba(118, 91, 34, 0.27);
  border-radius: 9px;
  color: var(--forest);
  background: rgba(255, 253, 239, 0.76);
  text-decoration: none;
  font-weight: 700;
  font-size: 10px;
  cursor: pointer;
}

.hq-header-actions { display: flex; gap: 8px; }
.hq-header-actions a { color: #f8e7aa; border-color: #c99b3d; background: linear-gradient(180deg, #337653, #17412c); }

.hq-identity { display: flex; align-items: center; gap: 14px; }
.hq-emblem {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 2px solid #d2a744;
  border-radius: 50%;
  color: #ffe49a;
  background: radial-gradient(circle, #3d8059, #173f2a 68%, #d4aa48 69% 75%, #173f2a 76%);
  box-shadow: inset 0 0 0 2px #f0d376, 0 6px 16px rgba(29, 60, 37, 0.24);
  font-size: 27px;
}
.hq-identity small, .hq-identity strong, .hq-identity em { display: block; }
.hq-identity small { color: #8b6727; font-size: 9px; font-weight: 700; letter-spacing: 1.1px; }
.hq-identity strong { margin-top: 2px; color: var(--forest); font-family: 'Literata', Georgia, serif; font-size: 25px; }
.hq-identity em { margin-top: 3px; color: #675d42; font-family: 'Literata', Georgia, serif; font-size: 10px; }

.hq-layout { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: calc(100vh - 92px); }

.hq-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100vh - 92px);
  padding: 15px 12px;
  border-right: 1px solid rgba(83, 78, 40, 0.23);
  background:
    repeating-linear-gradient(1deg, transparent 0 13px, rgba(108, 79, 24, 0.022) 14px),
    linear-gradient(180deg, rgba(255, 248, 221, 0.97), rgba(230, 217, 174, 0.96));
  overflow-y: auto;
}
.sidebar-summary { padding: 10px 11px 14px; border-bottom: 1px solid var(--line); }
.sidebar-summary span, .sidebar-summary strong, .sidebar-summary small { display: block; }
.sidebar-summary span { color: #8b692c; font-size: 8px; font-weight: 700; letter-spacing: 0.8px; }
.sidebar-summary strong { margin-top: 4px; color: var(--forest); font-family: 'Literata', Georgia, serif; font-size: 18px; }
.sidebar-summary small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.hq-sidebar nav { display: grid; gap: 4px; margin-top: 9px; }
.section-link {
  min-height: 43px;
  display: grid;
  grid-template-columns: 25px 1fr;
  gap: 7px;
  align-items: center;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  color: #4b584d;
  background: transparent;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}
.section-link span { font-size: 15px; text-align: center; }
.section-link:hover, .section-link.active { color: #ffe9a6; background: linear-gradient(180deg, #347553, #17412c); box-shadow: inset 0 0 0 1px #cda33d, 0 5px 15px rgba(27, 58, 35, 0.18); }
.sidebar-links { margin-top: 18px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255, 251, 232, 0.7); }
.sidebar-links > strong { display: block; margin-bottom: 6px; color: #87672e; font-size: 8px; }
.sidebar-links a { min-height: 34px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(87, 83, 48, 0.12); color: var(--forest); text-decoration: none; font-size: 8px; font-weight: 700; }
.sidebar-links a:last-child { border-bottom: 0; }

.hq-content { min-width: 0; padding: 14px 20px 34px; }
.command-strip {
  min-height: 43px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 7px 11px;
  border: 1px solid rgba(47, 112, 80, 0.22);
  border-radius: 11px;
  background: rgba(247, 247, 220, 0.86);
  box-shadow: 0 7px 21px rgba(37, 52, 30, 0.07);
  color: var(--muted);
  font-size: 8px;
}
.command-status { display: flex; align-items: center; gap: 7px; color: var(--forest); }
.command-status i { width: 8px; height: 8px; border-radius: 50%; background: #4f9b63; box-shadow: 0 0 0 4px rgba(79, 155, 99, 0.13); }
.command-strip button { min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--forest); background: #f2e5b4; font-size: 8px; font-weight: 700; cursor: pointer; }

.dashboard-section { display: none; margin-top: 14px; }
.dashboard-section.active { display: block; }
.section-heading {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 15px;
  border: 1px solid rgba(44, 89, 58, 0.22);
  border-radius: 13px;
  color: #f9e9ac;
  background:
    radial-gradient(circle at 85% -40%, rgba(246, 217, 127, 0.19), transparent 35%),
    linear-gradient(180deg, #357653, #173f2a);
  box-shadow: 0 10px 26px rgba(27, 54, 33, 0.16);
}
.section-heading small, .section-heading h1 { display: block; margin: 0; }
.section-heading small { color: #e8daa6; font-size: 8px; }
.section-heading h1 { margin-top: 2px; font-family: 'Literata', Georgia, serif; font-size: 18px; }
.period-pill { padding: 7px 10px; border: 1px solid rgba(255, 235, 171, 0.34); border-radius: 999px; background: rgba(255,255,255,0.07); font-size: 8px; font-weight: 700; }
.primary-action, .primary-link { min-height: 36px; display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid rgba(255, 236, 174, 0.36); border-radius: 8px; color: #ffeaa8; background: rgba(255,255,255,0.08); text-decoration: none; font-size: 9px; font-weight: 700; cursor: pointer; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 11px; }
.metric-grid article { min-height: 105px; display: grid; align-content: center; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(253, 248, 229, 0.95); box-shadow: var(--shadow); }
.metric-grid span, .metric-grid strong, .metric-grid small { display: block; }
.metric-grid span { color: #86652b; font-size: 7px; font-weight: 700; letter-spacing: 0.4px; }
.metric-grid strong { margin-top: 5px; color: var(--forest); font-family: 'Literata', Georgia, serif; font-size: 26px; }
.metric-grid small { margin-top: 3px; color: var(--muted); font-size: 8px; }

.overview-grid { display: grid; grid-template-columns: 1.35fr 0.8fr; gap: 11px; margin-top: 11px; }
.command-panel { border: 1px solid var(--line); border-radius: 13px; background: rgba(253, 248, 229, 0.95); box-shadow: var(--shadow); overflow: hidden; }
.panel-title { min-height: 46px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; color: #f8e7ab; background: linear-gradient(180deg, #347451, #17412c); }
.panel-title small, .panel-title strong { display: block; }
.panel-title small { color: #e7d9a5; font-size: 7px; }
.panel-title strong { margin-top: 2px; font-family: 'Literata', Georgia, serif; font-size: 12px; }
.panel-title button, .panel-title a { border: 0; color: #f7e4a5; background: transparent; text-decoration: none; font-size: 8px; font-weight: 700; cursor: pointer; }

.priority-list, .notice-list { padding: 8px 10px 10px; }
.priority-item, .notice-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; min-height: 50px; padding: 7px 5px; border-bottom: 1px solid rgba(83, 81, 45, 0.13); }
.priority-item:last-child, .notice-item:last-child { border-bottom: 0; }
.priority-item > span, .notice-item > span { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid rgba(172, 128, 38, 0.29); border-radius: 9px; background: rgba(224, 205, 142, 0.3); font-size: 16px; }
.priority-item b, .priority-item small, .notice-item b, .notice-item small { display: block; }
.priority-item b, .notice-item b { color: var(--forest); font-size: 9px; }
.priority-item small, .notice-item small { margin-top: 2px; color: var(--muted); font-size: 7px; line-height: 1.35; }
.priority-item em { padding: 4px 6px; border-radius: 999px; color: #825f25; background: #efe0aa; font-size: 7px; font-style: normal; font-weight: 700; white-space: nowrap; }

.progress-panel { display: grid; grid-template-columns: 145px 1fr; grid-template-rows: auto 1fr; }
.progress-panel .panel-title { grid-column: 1/-1; }
.progress-ring { width: 112px; height: 112px; display: grid; place-items: center; align-self: center; justify-self: center; margin: 14px; border-radius: 50%; background: conic-gradient(var(--forest-2) var(--progress), #e4d7a8 0); position: relative; }
.progress-ring::after { content: ''; position: absolute; inset: 12px; border-radius: 50%; background: #fbf5dc; }
.progress-ring span { position: relative; z-index: 1; text-align: center; }
.progress-ring strong, .progress-ring small { display: block; }
.progress-ring strong { color: var(--forest); font-family: 'Literata', Georgia, serif; font-size: 22px; }
.progress-ring small { color: var(--muted); font-size: 7px; }
.progress-notes { align-self: center; padding: 10px 13px 12px 0; }
.progress-notes p { display: grid; grid-template-columns: 9px 1fr; gap: 7px; align-items: start; margin: 0; padding: 7px 0; border-bottom: 1px solid rgba(83, 81, 45, 0.1); color: var(--muted); font-size: 7px; line-height: 1.4; }
.progress-notes p:last-child { border-bottom: 0; }
.progress-notes i { width: 8px; height: 8px; margin-top: 2px; border-radius: 50%; }
.progress-notes i.done { background: var(--success); }
.progress-notes i.working { background: var(--warning); }
.progress-notes i.review { background: var(--blue); }
.progress-notes b { color: var(--forest); }

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 10px; }
.quick-grid a, .quick-grid button { min-height: 82px; display: grid; align-content: center; justify-items: center; gap: 3px; padding: 8px; border: 1px solid rgba(95, 81, 39, 0.18); border-radius: 10px; color: var(--forest); background: rgba(255, 253, 239, 0.74); text-decoration: none; cursor: pointer; }
.quick-grid a:hover, .quick-grid button:hover { border-color: #caa13e; background: #f2e7bb; transform: translateY(-1px); }
.quick-grid span { font-size: 21px; }
.quick-grid b { font-size: 8px; }
.quick-grid small { color: var(--muted); font-size: 7px; }

.work-board { display: grid; grid-template-columns: repeat(4, minmax(205px, 1fr)); gap: 10px; margin-top: 11px; align-items: start; }
.work-column { min-height: 480px; border: 1px solid var(--line); border-radius: 12px; background: rgba(249, 245, 226, 0.92); box-shadow: var(--shadow); overflow: hidden; }
.column-heading { min-height: 48px; display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); background: rgba(232, 220, 176, 0.46); }
.column-heading b, .column-heading small { display: block; }
.column-heading b { color: var(--forest); font-size: 8px; }
.column-heading small { margin-top: 2px; color: var(--muted); font-size: 7px; }
.column-heading i { width: 9px; height: 9px; border-radius: 50%; background: #95743a; }
[data-status='doing'] .column-heading i { background: var(--warning); }
[data-status='review'] .column-heading i { background: var(--blue); }
[data-status='done'] .column-heading i { background: var(--success); }
.work-list { display: grid; gap: 8px; padding: 9px; }
.work-card { padding: 10px; border: 1px solid rgba(91, 81, 46, 0.16); border-radius: 10px; background: rgba(255, 253, 242, 0.9); box-shadow: 0 6px 16px rgba(37, 49, 30, 0.07); cursor: pointer; }
.work-card:hover { border-color: rgba(201, 155, 61, 0.65); transform: translateY(-1px); }
.work-card > span { display: flex; justify-content: space-between; gap: 7px; }
.work-card b, .work-card p, .work-card small { display: block; margin: 0; }
.work-card b { color: var(--forest); font-size: 9px; line-height: 1.35; }
.work-card p { margin-top: 6px; color: var(--muted); font-size: 7px; line-height: 1.5; }
.work-card small { margin-top: 8px; padding-top: 6px; border-top: 1px solid rgba(85, 80, 45, 0.11); color: #826328; font-size: 7px; }
.work-card em { padding: 3px 5px; border-radius: 999px; color: #7b5d27; background: #eee0ad; font-size: 6px; font-style: normal; white-space: nowrap; }

.filter-row { display: grid; grid-template-columns: 1fr 210px; gap: 9px; margin-top: 11px; }
.filter-row input, .filter-row select { width: 100%; height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: rgba(255, 253, 240, 0.9); }
.document-list { display: grid; gap: 8px; margin-top: 10px; }
.document-card { display: grid; grid-template-columns: 47px 1fr auto; gap: 10px; align-items: center; min-height: 76px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(253, 248, 229, 0.95); box-shadow: 0 8px 23px rgba(37, 49, 30, 0.08); }
.document-card > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; color: #ffe9a5; background: linear-gradient(180deg, #397754, #17412c); font-size: 20px; }
.document-card b, .document-card small, .document-card em { display: block; }
.document-card b { color: var(--forest); font-size: 9px; }
.document-card small { margin-top: 4px; color: var(--muted); font-size: 7px; }
.document-card em { margin-top: 4px; color: #87662c; font-size: 7px; font-style: normal; }
.document-card button { min-height: 31px; padding: 0 10px; border: 1px solid rgba(89, 80, 43, 0.2); border-radius: 7px; color: var(--forest); background: #efe2af; font-size: 7px; font-weight: 700; cursor: pointer; }

.calendar-layout { display: grid; grid-template-columns: minmax(580px, 1.3fr) minmax(300px, 0.7fr); gap: 11px; margin-top: 11px; }
.calendar-card, .agenda-card { border: 1px solid var(--line); border-radius: 12px; background: rgba(253, 248, 229, 0.95); box-shadow: var(--shadow); overflow: hidden; }
.calendar-header { min-height: 49px; display: flex; justify-content: space-between; align-items: center; padding: 7px 12px; color: #f8e8aa; background: linear-gradient(180deg, #347451, #17412c); }
.calendar-header strong { font-family: 'Literata', Georgia, serif; font-size: 13px; }
.calendar-header button { width: 32px; height: 32px; border: 1px solid rgba(255, 234, 170, 0.22); border-radius: 8px; color: #f8e8aa; background: rgba(255,255,255,0.06); cursor: pointer; }
.calendar-week, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-week { border-bottom: 1px solid var(--line); background: rgba(231, 219, 175, 0.46); }
.calendar-week span { min-height: 31px; display: grid; place-items: center; color: #7d632e; font-size: 7px; font-weight: 700; }
.calendar-day { min-height: 71px; padding: 6px; border-right: 1px solid rgba(83, 80, 43, 0.1); border-bottom: 1px solid rgba(83, 80, 43, 0.1); background: rgba(255, 253, 241, 0.65); cursor: pointer; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.outside { opacity: 0.38; }
.calendar-day.today { box-shadow: inset 0 0 0 2px #c99b3d; }
.calendar-day.selected { background: #ece5b9; }
.calendar-day b { color: var(--forest); font-size: 8px; }
.calendar-day i { width: 6px; height: 6px; display: block; margin-top: 14px; border-radius: 50%; background: var(--forest-2); }
.agenda-card { min-height: 480px; }
.agenda-list { display: grid; gap: 8px; padding: 10px; }
.agenda-item { padding: 10px; border: 1px solid rgba(86, 80, 44, 0.14); border-left: 4px solid var(--forest-2); border-radius: 9px; background: rgba(255,253,241,0.77); }
.agenda-item b, .agenda-item small, .agenda-item em { display: block; }
.agenda-item b { color: var(--forest); font-size: 9px; }
.agenda-item small { margin-top: 4px; color: var(--muted); font-size: 7px; line-height: 1.45; }
.agenda-item em { margin-top: 5px; color: #86642b; font-size: 7px; font-style: normal; }

.report-grid, .infographic-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 11px; }
.report-grid article, .infographic-card { min-height: 190px; display: grid; align-content: start; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: rgba(253, 248, 229, 0.95); box-shadow: var(--shadow); }
.report-grid article > span, .infographic-card > span { font-size: 30px; }
.report-grid b, .report-grid small, .infographic-card b, .infographic-card small { display: block; }
.report-grid b, .infographic-card b { margin-top: 10px; color: var(--forest); font-family: 'Literata', Georgia, serif; font-size: 12px; }
.report-grid small, .infographic-card small { margin-top: 7px; color: var(--muted); font-size: 7px; line-height: 1.5; }
.report-grid button, .report-grid a, .infographic-card button { align-self: end; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; margin-top: 14px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--forest); background: #efe2af; text-decoration: none; font-size: 7px; font-weight: 700; cursor: pointer; }

.inspection-table-wrap { margin-top: 11px; border: 1px solid var(--line); border-radius: 12px; background: rgba(253, 248, 229, 0.95); box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; border-bottom: 1px solid rgba(84, 80, 43, 0.12); text-align: left; font-size: 8px; }
th { color: #f7e5a5; background: linear-gradient(180deg, #347451, #17412c); font-size: 7px; letter-spacing: 0.3px; }
td { color: #536055; }
td:first-child { color: var(--forest); font-weight: 700; }
.status-tag { display: inline-flex; align-items: center; padding: 4px 7px; border-radius: 999px; font-size: 7px; font-weight: 700; }
.status-tag.doing { color: #7b5722; background: #f0dda7; }
.status-tag.review { color: #355e70; background: #dce9e9; }
.status-tag.done { color: #2f6542; background: #dcead9; }

.detail-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 25px; background: rgba(20, 40, 25, 0.58); backdrop-filter: blur(5px); }
.detail-backdrop[hidden] { display: none !important; }
.detail-dialog { width: min(720px, 90vw); max-height: 82vh; overflow: auto; position: relative; padding: 24px; border: 2px solid #c99b3d; border-radius: 15px; background: linear-gradient(145deg, #fff9dd, #eadbad); box-shadow: 0 30px 90px rgba(18, 40, 24, 0.42); }
.detail-close { position: absolute; top: 10px; right: 10px; width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 50%; color: var(--forest); background: rgba(255,253,238,0.82); font-size: 20px; cursor: pointer; }
.detail-dialog > span { color: #876528; font-size: 8px; font-weight: 700; letter-spacing: 0.7px; }
.detail-dialog h2 { margin: 5px 45px 10px 0; color: var(--forest); font-family: 'Literata', Georgia, serif; font-size: 23px; }
#detail-content { color: #566157; font-size: 9px; line-height: 1.65; }
.detail-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 13px; }
.detail-facts span { padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,253,241,0.7); }
.detail-facts b, .detail-facts small { display: block; }
.detail-facts b { color: var(--forest); font-size: 9px; }
.detail-facts small { margin-top: 3px; color: var(--muted); font-size: 7px; }

@media (max-width: 1280px) {
  body { min-width: 1000px; }
  .hq-header { grid-template-columns: auto 1fr; }
  .hq-header-actions { grid-column: 1/-1; justify-content: flex-end; margin-top: -7px; }
  .hq-layout { grid-template-columns: 218px minmax(0, 1fr); }
  .metric-grid, .report-grid, .infographic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
  .work-board { grid-template-columns: repeat(2, minmax(240px, 1fr)); }
}

@media (max-height: 760px) {
  .hq-header { min-height: 78px; }
  .hq-layout { min-height: calc(100vh - 78px); }
  .hq-sidebar { height: calc(100vh - 78px); }
  .metric-grid article { min-height: 88px; }
  .work-column { min-height: 390px; }
}
