:root{
  --bg:#ffffff;
  --ink:#111111;
  --muted:#6b7280;
  --line:#e5e7eb;
  --panel:#fafafa;
  --card:#ffffff;
  --shadow:0 8px 24px rgba(0,0,0,.06);
  --radius:18px;
}

*{
  box-sizing:border-box;
}

html,
body{
  height:100%;
  max-width:100%;
  overflow-x:hidden;
}

body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  animation:internalFade .45s ease;
}

/* =========================
   HEADER
========================= */

.top{
  position:sticky;
  top:0;
  z-index:50;
  background:rgba(255,255,255,.86);
  backdrop-filter:saturate(180%) blur(10px);
  border-bottom:1px solid var(--line);
}

.top__inner{
  max-width:1100px;
  margin:0 auto;
  padding:16px 18px;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
}

.brand__title{
  font-weight:800;
  letter-spacing:-.02em;
  font-size:22px;
}

.brand__sub{
  margin-top:4px;
  color:var(--muted);
  font-size:13px;
}

.stat{
  color:var(--muted);
  font-size:12px;
  text-align:right;
  white-space:nowrap;
}

/* =========================
   WRAP
========================= */

.wrap{
  max-width:1100px;
  margin:0 auto;
  padding:18px;
}

/* =========================
   FILTER PANEL
========================= */

.panel{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:14px;
}

.panel__row{
  display:flex;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
}

.panel__row--search{
  margin-top:10px;
}

.panel__row--meta{
  margin-top:10px;
}

.controlGroup{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:24px;
  padding:14px;
  box-shadow:0 8px 24px rgba(0,0,0,.05);
  margin-bottom:14px;
  max-width:100%;
  box-sizing:border-box;
}

.controlGroup .panel{
  border:none;
  background:transparent;
  border-radius:0;
  padding:0;
  box-shadow:none;
}

.controlGroup .toolNav{
  margin-top:14px;
  margin-bottom:0;
  padding-top:14px;
  border-top:1px solid #eef0f3;
}

/* =========================
   CHIPS
========================= */

.chips{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.chip{
  border:1px solid var(--line);
  background:#fff;
  border-radius:999px;
  padding:8px 12px;
  font-size:13px;
  color:#111;
  cursor:pointer;
  transition:.14s ease;
}

.chip:hover{
  transform:translateY(-1px);
}

.chip[aria-pressed="true"]{
  border-color:#111;
  box-shadow:0 0 0 1px #111 inset;
}

/* =========================
   MOBILE AGENCY SELECT
========================= */

.mobileAgencySelect{
  display:none;
  position:relative;
  width:100%;
}

.mobileAgencyButton{
  width:100%;
  border:none;
  cursor:pointer;
  font:inherit;
  font-family:inherit;
}

.mobileAgencyMenu[hidden]{
  display:none;
}

.mobileAgencyItem{
  width:100%;
  border:none;
  background:transparent;
  cursor:pointer;
  font:inherit;
  font-family:inherit;
  text-align:left;
}

@media (max-width:768px){
  .panel__row--agency{
    flex-direction:column;
    align-items:stretch;
  }

  .agencyChips{
    display:none;
  }

  .mobileAgencySelect{
    display:block;
    position:relative;
    width:100%;
    margin-bottom:14px;
  }

  .mobileAgencyButton{
    width:100%;
    height:52px;
    border-radius:16px;
    background:rgba(55,36,120,0.72);
    backdrop-filter:blur(18px);
    -webkit-backdrop-filter:blur(18px);
    color:#ffffff;
    border:1px solid rgba(255,255,255,0.12);
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 18px;
    font-weight:600;
    box-shadow:0 10px 28px rgba(0,0,0,0.18);
  }

  .mobileAgencyButton__caret{
    font-size:14px;
    opacity:0.9;
  }

  .mobileAgencyMenu{
    position:absolute;
    top:calc(100% + 10px);
    left:0;
    width:100%;
    background:rgba(55,36,120,0.58);
    backdrop-filter:blur(22px) saturate(140%);
    -webkit-backdrop-filter:blur(22px) saturate(140%);
    border:1px solid rgba(255,255,255,0.18);
    border-radius:18px;
    overflow:hidden;
    box-shadow:0 18px 42px rgba(0,0,0,0.18);
    z-index:30;
    max-height:min(60vh, 420px);
    overflow-y:auto;
  }

  .mobileAgencyItem{
    height:50px;
    display:flex;
    align-items:center;
    padding:0 18px;
    color:#ffffff;
    position:relative;
    transition:color .25s ease;
  }

  .mobileAgencyItem::after{
    content:"";
    position:absolute;
    left:18px;
    bottom:10px;
    width:0;
    height:2px;
    background:#F37021;
    transition:width .25s ease;
  }

  .mobileAgencyItem:hover,
  .mobileAgencyItem.is-active{
    color:#F37021;
  }

  .mobileAgencyItem:hover::after,
  .mobileAgencyItem.is-active::after{
    width:calc(100% - 36px);
  }
}

/* =========================
   SEARCH
========================= */

.search{
  position:relative;
  flex:1 1 420px;
  min-width:260px;
}

.search input{
  width:100%;
  padding:12px 42px 12px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  font-size:14px;
  outline:none;
  background:#fff;
}

#searchInput{
  color:#F37021;
}

#searchInput:focus{
  color:#F37021;
  border-color:#111;
  box-shadow:0 0 0 2px rgba(17,17,17,.08);
}

#searchInput::placeholder{
  color:rgba(107,114,128,0.72);
}

.search button{
  position:absolute;
  right:6px;
  top:50%;
  transform:translateY(-50%);
  width:32px;
  height:32px;
  border:1px solid var(--line);
  background:#fff;
  border-radius:10px;
  cursor:pointer;
  color:#111;
  font-size:18px;
  line-height:1;
}

/* =========================
   SELECT
========================= */

.controls{
  display:flex;
  align-items:center;
  gap:10px;
}

.select{
  display:flex;
  align-items:center;
  gap:8px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:12px;
  padding:8px 10px;
}

.select__label{
  font-size:12px;
  color:var(--muted);
}

select{
  border:none;
  outline:none;
  background:transparent;
  font-size:13px;
  color:#111;
}

/* =========================
   META
========================= */

.meta{
  width:100%;
  display:flex;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.meta__left{
  font-size:13px;
  font-weight:700;
}

.meta__right{
  font-size:12px;
  color:var(--muted);
}

/* =========================
   GRID
========================= */

.grid{
  margin-top:14px;
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:12px;
  align-items:start;
}

@media (max-width:980px){
  .grid{
    grid-template-columns:repeat(2, 1fr);
  }
}

@media (max-width:620px){
  .grid{
    grid-template-columns:1fr;
  }
}

/* =========================
   CARD
========================= */

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:14px 14px 12px;
  box-shadow:var(--shadow);
  cursor:pointer;
  max-width:100%;
  box-sizing:border-box;
  min-width:0;
  transition:
    transform .14s ease,
    box-shadow .14s ease,
    border-color .14s ease;
}

.card:hover{
  transform:translateY(-2px);
  border-color:#d1d5db;
  box-shadow:0 12px 30px rgba(0,0,0,.09);
}

.badge{
  display:inline-flex;
  align-items:center;
  border:1px solid var(--line);
  border-radius:999px;
  padding:6px 10px;
  font-size:12px;
  color:#111;
  background:#fff;
}

.dept{
  margin-top:10px;
  font-size:17px;
  font-weight:800;
  letter-spacing:-.02em;
  line-height:1.35;
  word-break:keep-all;
}

.location{
  margin-top:6px;
  font-size:12px;
  line-height:1.4;
  color:#4b5563;
  letter-spacing:-.01em;
  word-break:keep-all;
}

.officer{
  margin-top:6px;
  font-size:13px;
  color:var(--muted);
}

.project{
  margin-top:10px;
  font-size:14px;
  line-height:1.5;
  white-space:pre-wrap;
  word-break:keep-all;
}

.kv{
  margin-top:12px;
  padding-top:12px;
  border-top:1px dashed var(--line);
  display:flex;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}

.kv__item{
  font-size:13px;
}

.kv__label{
  color:var(--muted);
  font-size:12px;
  margin-right:6px;
}

.kv__value{
  font-weight:800;
}

/* =========================
   DETAIL TABLE
========================= */

.detail{
  display:none;
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid var(--line);
  max-width:100%;
  overflow:hidden;
}

.card.is-open .detail{
  display:block;
}

.detail__title{
  font-size:13px;
  font-weight:800;
  margin-bottom:10px;
}

.detail__tableWrap{
  width:100%;
  max-width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}

.detail__table{
  width:100%;
  border-collapse:collapse;
  min-width:560px;
  font-size:12px;
}

.detail__table thead th{
  text-align:left;
  color:var(--muted);
  font-weight:700;
  border-bottom:1px solid var(--line);
  padding:8px 6px;
  white-space:nowrap;
}

.detail__table tbody td{
  border-bottom:1px solid #f3f4f6;
  padding:9px 6px;
  vertical-align:top;
  line-height:1.45;
}

.detail__table .num{
  text-align:right;
  white-space:nowrap;
}

.detail__table .strong{
  font-weight:800;
}

/* =========================
   OPEN CARD
========================= */

.card.is-open{
  background:linear-gradient(135deg, #372478 0%, #563fa3 100%);
  border-color:rgba(243,112,33,0.55);
  color:#ffffff;
  box-shadow:0 18px 42px rgba(55,36,120,0.28);
  overflow:hidden;
}

.card.is-open:hover{
  border-color:rgba(243,112,33,0.75);
  box-shadow:0 20px 48px rgba(55,36,120,0.36);
}

.card.is-open .badge{
  border-color:rgba(243,112,33,0.55);
  background:rgba(255,255,255,0.08);
  color:#F37021;
}

.card.is-open .dept{
  color:#ffffff;
}

.card.is-open .location,
.card.is-open .officer,
.card.is-open .project,
.card.is-open .kv__label{
  color:rgba(255,255,255,0.78);
}

.card.is-open .kv__value,
.card.is-open .detail__title,
.card.is-open .detail__table .strong{
  color:#F37021;
}

.card.is-open .kv{
  border-top-color:rgba(255,255,255,0.22);
}

.card.is-open .detail{
  border-top-color:rgba(255,255,255,0.22);
}

.card.is-open .detail__table thead th{
  color:rgba(255,255,255,0.72);
  border-bottom-color:rgba(255,255,255,0.2);
}

.card.is-open .detail__table tbody td{
  color:rgba(255,255,255,0.86);
  border-bottom-color:rgba(255,255,255,0.12);
}

.card.is-open .detail__tableWrap{
  scrollbar-color:rgba(243,112,33,0.55) rgba(255,255,255,0.12);
}

@media (max-width:620px){
  .wrap,
  .controlGroup,
  .panel,
  .grid,
  .card{
    width:100%;
    max-width:100%;
    box-sizing:border-box;
  }

  .grid{
    min-width:0;
  }

  .card.is-open{
    width:100%;
    max-width:100%;
    background:linear-gradient(145deg, #372478 0%, #563fa3 100%);
    border-color:rgba(243,112,33,0.6);
    box-shadow:0 14px 34px rgba(55,36,120,0.32);
  }

  .card.is-open .dept{
    font-size:16px;
    line-height:1.42;
  }

  .card.is-open .project{
    font-size:13px;
    line-height:1.55;
  }

  .card.is-open .location,
  .card.is-open .officer{
    font-size:12px;
  }

  .detail__tableWrap{
    width:100%;
    max-width:100%;
    overflow-x:auto;
  }

  .detail__table{
    min-width:520px;
  }
}

/* =========================
   FOOTER
========================= */

.footer{
  border-top:1px solid var(--line);
  margin-top:22px;
}

.footer__inner{
  max-width:1100px;
  margin:0 auto;
  padding:14px 18px 26px;
  display:flex;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}

.footer__small{
  font-size:12px;
  color:var(--muted);
}

/* =========================
   TOOLS: NAV / VIEWS
========================= */

.toolNav{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:14px;
  margin-bottom:14px;
}

.toolNav__btn{
  flex:1 1 100px;
  min-height:44px;
  padding:10px 14px;
  border:1px solid var(--line);
  border-radius:999px;
  background:#fff;
  color:#111;
  font-size:13px;
  font-weight:600;
  cursor:pointer;
  font-family:inherit;
  transition:
    border-color .14s ease,
    color .14s ease,
    box-shadow .14s ease;
}

.toolNav__btn:hover{
  border-color:#372478;
  color:#F37021;
}

.toolNav__btn.is-active{
  border-color:#372478;
  background:#372478;
  color:#fff;
  box-shadow:0 8px 20px rgba(55,36,120,0.2);
}

.toolView--hidden{
  display:none !important;
}

.toolView{
  margin-bottom:14px;
  max-width:100%;
}

.toolBackButton{
  display:inline-flex;
  align-items:center;
  min-height:44px;
  margin-bottom:12px;
  padding:0;
  border:none;
  background:transparent;
  color:#372478;
  font-size:14px;
  font-weight:700;
  cursor:pointer;
  font-family:inherit;
}

.toolBackButton:hover{
  color:#F37021;
}

.toolHeader{
  margin-bottom:14px;
}

.toolHeader__title{
  margin:0;
  font-size:20px;
  font-weight:800;
  letter-spacing:-.02em;
}

.toolHeader__desc{
  margin:6px 0 0;
  font-size:13px;
  color:var(--muted);
  line-height:1.5;
}

.toolSearch{
  margin-bottom:14px;
}

.toolSearch input{
  width:100%;
  min-height:48px;
  padding:12px 14px;
  border:1px solid var(--line);
  border-radius:12px;
  font-size:14px;
  outline:none;
  background:#fff;
  font-family:inherit;
  box-sizing:border-box;
}

.toolSearch input:focus{
  border-color:#F37021;
  box-shadow:0 0 0 2px rgba(243,112,33,0.12);
}

.toolForm{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:14px;
  margin-bottom:16px;
  box-shadow:var(--shadow);
}

.toolForm__grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}

.toolField{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.toolField--full{
  grid-column:1 / -1;
}

.toolField__label{
  font-size:12px;
  color:var(--muted);
  font-weight:600;
}

.toolField input,
.toolField textarea{
  width:100%;
  min-height:44px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  font-size:14px;
  outline:none;
  background:#fff;
  font-family:inherit;
  box-sizing:border-box;
}

.toolField textarea{
  min-height:96px;
  resize:vertical;
}

.toolField input:focus,
.toolField textarea:focus{
  border-color:#F37021;
  box-shadow:0 0 0 2px rgba(243,112,33,0.12);
}

.toolForm__actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:12px;
}

.toolBtn{
  min-height:44px;
  padding:10px 16px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  font-size:13px;
  font-weight:600;
  cursor:pointer;
  font-family:inherit;
  transition:
    border-color .14s ease,
    color .14s ease,
    background .14s ease;
}

.toolBtn:hover{
  border-color:#F37021;
  color:#F37021;
}

.toolBtn--primary{
  background:#372478;
  border-color:#372478;
  color:#fff;
}

.toolBtn--primary:hover{
  background:#563fa3;
  border-color:#563fa3;
  color:#fff;
}

.toolBtn--danger{
  color:#b91c1c;
  border-color:#fecaca;
}

.toolBtn--danger:hover{
  color:#fff;
  background:#b91c1c;
  border-color:#b91c1c;
}

.toolList{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.toolEmpty{
  margin:0;
  padding:16px;
  text-align:center;
  color:var(--muted);
  font-size:13px;
  border:1px dashed var(--line);
  border-radius:14px;
  background:#fff;
}

.contactCard,
.noteCard{
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:14px;
  background:#fff;
  box-shadow:var(--shadow);
  max-width:100%;
  box-sizing:border-box;
}

.contactCard__name,
.noteCard__title{
  margin:0;
  font-size:16px;
  font-weight:800;
  letter-spacing:-.02em;
  word-break:keep-all;
}

.contactCard__meta,
.noteCard__date{
  margin:6px 0 0;
  font-size:12px;
  color:var(--muted);
}

.contactCard__line{
  margin:8px 0 0;
  font-size:13px;
  line-height:1.55;
  word-break:break-all;
}

.contactCard__line a{
  color:#F37021;
  text-decoration:none;
  font-weight:600;
  word-break:break-all;
}

.contactCard__line a:hover{
  text-decoration:underline;
}

@media (max-width:768px){
  .contactCard__line a.contactPhoneLink{
    display:inline-block;
    padding:6px 4px;
    margin:-2px 0;
  }
}

.contactCard__address{
  margin:8px 0 0;
  font-size:13px;
  line-height:1.55;
  word-break:break-all;
}

.contactCard__memo,
.noteCard__content{
  margin:10px 0 0;
  font-size:13px;
  line-height:1.6;
  white-space:pre-wrap;
  word-break:break-word;
}

.toolCard__actions{
  margin-top:12px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.contactCard .toolCard__actions .toolBtn{
  min-height:38px;
  padding:8px 12px;
  font-size:12px;
}

.contactsList,
.toolList#contactsList{
  max-width:100%;
}

@media (max-width:768px){
  .toolForm__grid{
    grid-template-columns:1fr;
  }

  .toolNav__btn{
    flex:1 1 calc(33.333% - 6px);
    min-width:0;
    padding:10px 8px;
    font-size:12px;
  }
}

.back-home-link{
  display:inline-flex;
  align-items:center;
  gap:6px;

  padding:10px 16px;

  border-radius:999px;

  background:rgba(255,255,255,.72);

  border:1px solid rgba(255,255,255,.55);

  backdrop-filter:blur(14px);

  color:#5b3df5;

  font-size:14px;
  font-weight:600;

  text-decoration:none;

  transition:.28s ease;

  margin-bottom:18px;
}

.back-home-link:hover{
  color:#F37021;
  border-color:#F37021;
  transform:translateY(-1px);
}

@keyframes internalFade{
  from{
    opacity:0;
    transform:translateY(8px);
  }
  to{
    opacity:1;
    transform:none;
  }
}

/* =========================
   INTERNAL AUTH
========================= */

#internalContent{
  display:none;
}

#internalContent.show{
  display:block;
  animation:internalFade .45s ease;
}

.internalAuthWrap{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:rgba(20,16,40,.38);
  backdrop-filter:blur(18px);
  z-index:99999;
}

.internalAuthWrap.hide{
  display:none;
}

.internalAuthCard{
  width:100%;
  max-width:420px;
  padding:36px 28px;
  border-radius:28px;
  background:rgba(255,255,255,.78);
  border:1px solid rgba(255,255,255,.65);
  box-shadow:0 24px 60px rgba(0,0,0,.14);
  text-align:center;
}

.internalAuthLogo{
  font-size:14px;
  font-weight:700;
  letter-spacing:.24em;
  color:#5b3df5;
  margin-bottom:10px;
}

.internalAuthTitle{
  font-size:34px;
  font-weight:800;
  margin:0 0 10px;
  color:#111;
}

.internalAuthDesc{
  font-size:14px;
  color:#666;
  margin:0 0 24px;
}

.internalPasswordInput{
  width:100%;
  height:58px;
  border-radius:18px;
  border:1px solid #ddd;
  padding:0 18px;
  font-size:16px;
  outline:none;
  transition:.28s ease;
  background:#fff;
  margin-bottom:14px;
}

.internalPasswordInput:focus{
  border-color:#5b3df5;
  box-shadow:0 0 0 4px rgba(91,61,245,.12);
}

.internalPasswordBtn{
  width:100%;
  height:58px;
  border:none;
  border-radius:18px;
  background:#5b3df5;
  color:#fff;
  font-size:15px;
  font-weight:700;
  cursor:pointer;
  transition:.28s ease;
}

.internalPasswordBtn:hover{
  background:#F37021;
}

.internalAuthError{
  margin-top:14px;
  font-size:13px;
  color:#e53935;
  min-height:18px;
}

.internalLogoutBtn{
  position:fixed;
  top:18px;
  right:18px;
  z-index:9999;
  height:42px;
  padding:0 18px;
  border:none;
  border-radius:999px;
  background:#5b3df5;
  color:#fff;
  font-size:13px;
  font-weight:700;
  cursor:pointer;
  transition:.28s ease;
}

.internalLogoutBtn:hover{
  background:#F37021;
}

.internalAuthWrap.shake{
  animation:shake .32s ease;
}

@keyframes shake{
  0%{ transform:translateX(0); }
  20%{ transform:translateX(-8px); }
  40%{ transform:translateX(8px); }
  60%{ transform:translateX(-6px); }
  80%{ transform:translateX(6px); }
  100%{ transform:none; }
}

@media (max-width:768px){
  .internalAuthCard{
    padding:30px 22px;
  }

  .internalAuthTitle{
    font-size:28px;
  }

  .internalPasswordInput,
  .internalPasswordBtn{
    height:54px;
  }

  .internalLogoutBtn{
    top:14px;
    right:14px;
  }
}