@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 {
  --ink: #1d3324;
  --ink-soft: #566458;
  --forest: #173f2b;
  --forest-2: #2d6a49;
  --jade: #458163;
  --gold: #c99b40;
  --paper: rgba(252, 247, 228, 0.96);
  --paper-soft: rgba(255, 252, 238, 0.88);
  --line: rgba(80, 83, 47, 0.24);
  --danger: #b44f35;
  --shadow: 0 20px 60px rgba(22, 45, 28, 0.24);
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #dfe5cc; color: var(--ink); }
body { overflow-x: hidden; }
button, input, textarea { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(201, 155, 64, 0.74); outline-offset: 2px; }

.branch-app { min-width: 1180px; min-height: 100vh; }
.branch-header {
  min-height: 92px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 12px 28px;
  background:
    radial-gradient(circle at 70% 15%, rgba(230, 204, 121, 0.3), transparent 33%),
    linear-gradient(180deg, #fffdf3, #f4ecd0);
  border-bottom: 4px solid rgba(45, 106, 73, 0.35);
  position: relative;
  z-index: 20;
}
.back-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border: 1px solid rgba(85, 73, 34, 0.24);
  border-radius: 10px;
  color: var(--forest);
  background: rgba(255,255,247,.72);
  text-decoration: none;
  font-weight: 700;
}
.branch-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.branch-seal { width: 60px; height: 60px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 50% 42%, #3d815f, #153e2a 67%, #d4a84f 68% 74%, #194630 75%); color: #f8dda0; font-family: 'Literata', serif; font-weight: 700; box-shadow: inset 0 0 0 2px #efcf77, 0 5px 14px rgba(25,62,37,.25); }
.branch-identity small, .branch-identity strong, .branch-identity em { display: block; }
.branch-identity small { color: #8c6c31; font-weight: 700; letter-spacing: 1px; }
.branch-identity strong { margin-top: 2px; font-family: 'Literata', serif; font-size: 28px; color: var(--forest); }
.branch-identity em { margin-top: 3px; font-family: 'Literata', serif; color: #655f46; font-size: 12px; }
.branch-status { display: flex; align-items: center; gap: 8px; }
.branch-status > span { min-width: 110px; min-height: 53px; display: grid; align-content: center; padding: 6px 10px; border: 1px solid rgba(88,75,35,.2); border-radius: 11px; background: rgba(255,255,245,.7); }
.branch-status small, .branch-status strong { display: block; }
.branch-status small { font-size: 9px; color: var(--ink-soft); }
.branch-status strong { margin-top: 2px; font-family: 'Literata', serif; color: var(--forest); }
.branch-status button { min-height: 44px; padding: 0 13px; border: 1px solid #c59a45; border-radius: 10px; color: white; background: linear-gradient(180deg, #337451, #17422d); cursor: pointer; }

.branch-switcher {
  min-height: 48px;
  display: grid;
  grid-template-columns: repeat(7, minmax(125px, 1fr));
  gap: 3px;
  padding: 6px 5%;
  background: linear-gradient(180deg, rgba(255,252,236,.98), rgba(238,226,187,.96));
  border-bottom: 1px solid rgba(77,84,47,.28);
  box-shadow: 0 7px 19px rgba(42,61,40,.12);
  position: relative;
  z-index: 18;
}
.branch-switcher button { border: 0; border-radius: 7px; background: transparent; color: #47513f; cursor: pointer; font-family: 'Literata', serif; }
.branch-switcher button:hover, .branch-switcher button.active { color: white; background: linear-gradient(180deg, #377553, #18442e); box-shadow: inset 0 0 0 1px rgba(230,197,88,.65); }

.branch-scene {
  min-height: calc(100vh - 140px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 20px 26px 120px;
  background:
    linear-gradient(180deg, rgba(255,225,137,.16), transparent 34%, rgba(20,53,31,.2)),
    url('/my-phu-summer.svg') center 46% / cover no-repeat,
    #91aa75;
}
.branch-scene::after { content: ''; position: absolute; inset: 0; z-index: 5; pointer-events: none; box-shadow: inset 0 0 130px rgba(20,51,31,.3); }
.scene-mist { position: absolute; z-index: 1; width: 240px; height: 70px; border-radius: 50%; background: rgba(255,255,255,.16); filter: blur(14px); pointer-events: none; }
.mist-one { left: -12%; top: 13%; animation: mistDrift 52s linear infinite; }
.mist-two { left: -24%; top: 34%; transform: scale(.75); animation: mistDrift 73s linear 9s infinite; }
.water-light { position: absolute; inset: 22% 17% 10% 14%; z-index: 1; opacity: .18; mix-blend-mode: screen; pointer-events: none; clip-path: polygon(40% 0, 58% 11%, 68% 29%, 100% 48%, 76% 64%, 60% 100%, 42% 78%, 21% 98%, 29% 61%, 0 38%, 23% 22%); background: repeating-linear-gradient(105deg, transparent 0 17px, rgba(255,255,220,.55) 20px 22px, transparent 26px 44px); animation: waterMove 13s linear infinite; }
.field-worker { position: absolute; z-index: 3; font-size: 25px; filter: drop-shadow(0 4px 3px rgba(28,59,38,.35)); animation: workerMove 11s ease-in-out infinite alternate; }
.worker-one { right: 16%; bottom: 18%; }
.worker-two { left: 20%; bottom: 21%; animation-delay: 2.5s; }

.branch-building { position: absolute; z-index: 4; left: 50%; top: 16%; transform: translateX(-50%); display: grid; justify-items: center; pointer-events: none; }
.branch-flag { width: 36px; height: 36px; display: grid; place-items: center; color: #f7d876; background: #1d5b3a; border-radius: 50% 50% 4px 50%; transform: rotate(45deg); box-shadow: 0 5px 12px rgba(22,54,33,.28); }
.branch-flag::first-letter { transform: rotate(-45deg); }
.branch-building-label { margin-top: 5px; padding: 7px 14px; border: 1px solid #e0ba5a; border-radius: 7px 7px 14px 14px; color: #f7e6a6; font-family: 'Literata', serif; font-weight: 700; font-size: 12px; background: linear-gradient(180deg, rgba(44,101,70,.98), rgba(18,57,37,.98)); box-shadow: 0 8px 18px rgba(17,47,29,.25); }

.today-pulse { position: relative; z-index: 8; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 1100px; margin: 0 auto 12px; }
.today-pulse article { min-height: 76px; display: grid; grid-template-columns: 42px 1fr; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid rgba(95,77,32,.29); border-radius: 14px; background: rgba(252,247,228,.92); box-shadow: 0 10px 24px rgba(22,49,30,.16); }
.pulse-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: rgba(50,112,77,.12); font-size: 21px; }
.today-pulse small, .today-pulse strong, .today-pulse em { display: block; }
.today-pulse small { color: #8c6b2e; font-weight: 700; font-size: 8px; }
.today-pulse strong { margin-top: 2px; font-family: 'Literata', serif; font-size: 12px; }
.today-pulse em { margin-top: 3px; color: var(--ink-soft); font-size: 8px; }

.branch-command-panel { position: relative; z-index: 9; width: min(930px, calc(100% - 320px)); margin: 118px auto 0; border: 1px solid rgba(96,78,31,.36); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); overflow: hidden; }
.panel-topline { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; padding: 20px 22px 16px; background: linear-gradient(145deg, rgba(255,253,240,.98), rgba(235,226,190,.94)); border-bottom: 1px solid var(--line); }
.eyebrow { color: #977333; font-weight: 700; font-size: 9px; letter-spacing: .8px; text-transform: uppercase; }
.panel-topline h1 { margin: 5px 0 4px; font-family: 'Literata', serif; font-size: 25px; color: var(--forest); }
.panel-topline p { margin: 0; max-width: 620px; color: var(--ink-soft); font-size: 10px; line-height: 1.55; }
.score-summary { display: grid; grid-template-columns: repeat(2, 130px); gap: 8px; }
.score-summary > span { padding: 10px; border: 1px solid rgba(86,81,45,.18); border-radius: 11px; background: rgba(255,255,248,.67); }
.score-summary small, .score-summary strong, .score-summary em { display: block; }
.score-summary small { font-size: 8px; color: var(--ink-soft); }
.score-summary strong { margin-top: 2px; font-family: 'Literata', serif; color: var(--forest); font-size: 19px; }
.score-summary em { margin-top: 2px; font-size: 8px; color: #8c6c31; }

.branch-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 8px; background: rgba(229,221,180,.6); border-bottom: 1px solid var(--line); }
.branch-tabs button { min-height: 36px; border: 0; border-radius: 8px; background: transparent; color: #495345; cursor: pointer; font-family: 'Literata', serif; }
.branch-tabs button.active { color: white; background: linear-gradient(180deg, #347553, #18442e); }
.tab-content { display: none; padding: 14px; }
.tab-content.active { display: grid; }
#tab-activity { grid-template-columns: minmax(0, 1.4fr) minmax(270px, .7fr); gap: 14px; }
.section-heading { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.section-heading small, .section-heading strong { display: block; }
.section-heading small { color: #8d6b2f; font-size: 8px; font-weight: 700; }
.section-heading strong { font-family: 'Literata', serif; font-size: 15px; }
.section-heading button { min-height: 32px; padding: 0 10px; border: 1px solid rgba(89,76,37,.2); border-radius: 8px; background: #f3e8bd; color: var(--forest); cursor: pointer; font-size: 9px; }
.section-heading i { font-size: 9px; color: var(--forest-2); }

.mission-card { width: 100%; display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 11px; border: 1px solid rgba(80,84,50,.15); border-radius: 12px; background: rgba(255,255,248,.7); cursor: pointer; text-align: left; }
.mission-card + .mission-card { margin-top: 7px; }
.mission-card:hover { border-color: rgba(45,106,73,.42); background: rgba(224,231,199,.65); }
.mission-card.priority { box-shadow: inset 4px 0 0 #c57a3c; }
.mission-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--forest-2); color: white; font-size: 20px; }
.mission-card strong, .mission-card small, .mission-card em { display: block; }
.mission-card strong { font-family: 'Literata', serif; font-size: 11px; }
.mission-card small { margin-top: 3px; color: var(--ink-soft); font-size: 8px; line-height: 1.35; }
.mission-card em { margin-top: 4px; color: #8b6a2f; font-size: 8px; }
.mission-card b { padding: 6px 8px; border-radius: 999px; color: var(--forest); background: rgba(51,112,78,.12); font-size: 8px; white-space: nowrap; }

.branch-chat { border: 1px solid rgba(80,84,50,.15); border-radius: 13px; background: rgba(255,255,249,.68); overflow: hidden; }
.branch-chat .section-heading { padding: 10px 11px 4px; margin: 0; }
.branch-chat-list { max-height: 225px; overflow: auto; padding: 5px 9px; }
.branch-chat-list article { display: grid; grid-template-columns: 34px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid rgba(80,84,50,.1); }
.branch-chat-list article > span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: white; background: linear-gradient(145deg, #d5b65f, #2e7650); font-size: 8px; font-weight: 700; }
.branch-chat-list p { margin: 0; color: var(--ink-soft); font-size: 8px; line-height: 1.45; position: relative; }
.branch-chat-list strong { display: block; color: var(--ink); font-size: 9px; }
.branch-chat-list small { position: absolute; right: 0; top: 0; color: #817d65; }
.branch-chat-form { display: grid; grid-template-columns: 1fr 36px; gap: 5px; padding: 8px; border-top: 1px solid var(--line); }
.branch-chat-form input { min-width: 0; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 9px; background: rgba(255,255,255,.72); font-size: 9px; }
.branch-chat-form button { border: 0; border-radius: 8px; color: white; background: var(--forest-2); cursor: pointer; }

.people-grid, .achievement-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.people-grid article, .achievement-grid article { min-height: 140px; display: grid; align-content: center; justify-items: center; text-align: center; padding: 15px; border: 1px solid rgba(81,82,47,.16); border-radius: 13px; background: rgba(255,255,248,.72); }
.people-grid span { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--forest-2); font-weight: 700; }
.people-grid strong, .achievement-grid strong { margin-top: 8px; font-family: 'Literata', serif; font-size: 11px; }
.people-grid small, .achievement-grid small { margin-top: 5px; color: var(--ink-soft); font-size: 8px; line-height: 1.4; }
.achievement-grid span { font-size: 34px; }
.timeline { display: grid; gap: 8px; }
.timeline article { display: grid; grid-template-columns: 85px 1fr; gap: 13px; align-items: center; padding: 10px 12px; border: 1px solid rgba(82,83,48,.14); border-radius: 11px; background: rgba(255,255,248,.66); }
.timeline time { color: #8b6a30; font-weight: 700; font-size: 9px; }
.timeline strong, .timeline small { display: block; }
.timeline strong { font-family: 'Literata', serif; font-size: 10px; }
.timeline small { margin-top: 3px; color: var(--ink-soft); font-size: 8px; }

.construction-dock { position: absolute; left: 26px; right: 26px; bottom: 18px; z-index: 12; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.construction-dock button { min-height: 78px; display: grid; grid-template-columns: 45px 1fr; grid-template-rows: auto auto; gap: 2px 10px; align-items: center; text-align: left; padding: 11px 14px; border: 1px solid rgba(93,74,28,.34); border-radius: 14px; background: var(--paper); box-shadow: 0 12px 26px rgba(22,48,30,.18); cursor: pointer; }
.construction-dock button:hover { transform: translateY(-2px); }
.construction-dock span { grid-row: 1 / 3; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: rgba(45,106,73,.12); font-size: 23px; }
.construction-dock strong { font-family: 'Literata', serif; font-size: 12px; }
.construction-dock small { color: var(--ink-soft); font-size: 8px; }

.detail-backdrop { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 24px; background: rgba(16,38,23,.48); backdrop-filter: blur(5px); }
.detail-modal { width: min(680px, 92vw); max-height: 84vh; overflow: auto; position: relative; padding: 28px; border: 1px solid rgba(115,88,28,.4); border-radius: 20px; background: linear-gradient(145deg, rgba(255,253,240,.99), rgba(240,231,196,.98)); box-shadow: 0 30px 95px rgba(14,36,22,.37); }
.detail-close { position: absolute; top: 12px; right: 13px; width: 35px; height: 35px; border: 1px solid rgba(91,72,30,.3); border-radius: 50%; background: #f2e6b8; cursor: pointer; font-size: 23px; }
.detail-eyebrow { color: #947030; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.detail-modal h2 { margin: 7px 0 6px; font-family: 'Literata', serif; color: var(--forest); font-size: 28px; }
.detail-modal > p { margin: 0 0 17px; color: var(--ink-soft); font-size: 10px; line-height: 1.6; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.detail-grid article { min-height: 72px; padding: 12px; border: 1px solid rgba(82,83,48,.16); border-radius: 11px; background: rgba(255,255,249,.7); }
.detail-grid strong, .detail-grid small { display: block; }
.detail-grid strong { color: var(--forest); font-size: 11px; }
.detail-grid small { margin-top: 4px; color: var(--ink-soft); font-size: 8px; line-height: 1.4; }
.evidence-box { margin-top: 15px; padding: 14px; border: 1px dashed rgba(45,106,73,.4); border-radius: 12px; background: rgba(226,232,199,.48); }
.evidence-box > strong { font-family: 'Literata', serif; color: var(--forest); }
.evidence-box label { display: grid; gap: 5px; margin-top: 10px; }
.evidence-box label span { font-size: 9px; font-weight: 700; }
.evidence-box textarea, .evidence-box input { width: 100%; border: 1px solid rgba(80,84,50,.22); border-radius: 8px; padding: 8px; background: rgba(255,255,255,.72); }
.evidence-box button { margin-top: 11px; min-height: 38px; padding: 0 13px; border: 1px solid #d0aa4d; border-radius: 9px; color: white; background: var(--forest-2); cursor: pointer; }

@keyframes mistDrift { from { transform: translateX(0); } to { transform: translateX(155vw); } }
@keyframes waterMove { from { background-position: 0 0; } to { background-position: 220px 0; } }
@keyframes workerMove { from { transform: translate(0,0); } to { transform: translate(20px,-8px); } }

@media (max-height: 780px) {
  .branch-header { min-height: 80px; padding-block: 8px; }
  .branch-identity strong { font-size: 24px; }
  .branch-switcher { min-height: 44px; }
  .branch-scene { min-height: calc(100vh - 124px); padding-bottom: 102px; }
  .branch-command-panel { margin-top: 95px; }
  .construction-dock button { min-height: 66px; }
}

@media (max-width: 1250px) {
  .branch-app { min-width: 1024px; }
  .branch-header { grid-template-columns: auto 1fr; }
  .branch-status { grid-column: 1 / -1; justify-content: flex-end; margin-top: -6px; }
  .branch-command-panel { width: min(900px, calc(100% - 100px)); }
  .today-pulse { max-width: 970px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
