/* International Citizens Hub (ICH) — a deliberately distinct sub-brand from
   the main site's UN-blue/gold/red look (see css/styles.css). Blue / white /
   yellow, sidebar + content-panel layout. Scoped entirely to ich-*.html
   pages — nothing here is shared with or overrides styles.css/staff.css. */

:root {
  --ich-blue: #1350c4;
  --ich-blue-deep: #0b2e73;
  --ich-yellow: #ffc72c;
  --ich-white: #ffffff;
  --ich-ink: #0b1830;
  --ich-ink-soft: #5b6b85;
  --ich-line: #dbe3f0;
}

* { box-sizing: border-box; }

body.ich {
  margin: 0;
  background: var(--ich-white);
  color: var(--ich-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.ich-wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ---------- login pages ---------- */

.ich-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--ich-blue-deep) 0%, var(--ich-blue) 60%, var(--ich-blue) 100%);
  padding: 24px;
}

.ich-login-card {
  background: var(--ich-white);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(11, 24, 48, 0.35);
  width: 100%;
  max-width: 420px;
  padding: 40px 36px;
  text-align: center;
}

.ich-login-logo { width: 64px; height: 64px; border-radius: 50%; margin-bottom: 16px; }

.ich-login-card .ich-eyebrow {
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ich-blue); margin: 0 0 6px;
}
.ich-login-card h1 { font-size: 1.5rem; margin: 0 0 10px; color: var(--ich-ink); }
.ich-login-card p.ich-lede { color: var(--ich-ink-soft); font-size: 0.92rem; margin: 0 0 28px; }

.ich-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 14px 20px; border-radius: 8px; border: none;
  font-weight: 700; font-size: 0.92rem; cursor: pointer; text-decoration: none;
}
.ich-btn-discord { background: #5865f2; color: #fff; }
.ich-btn-discord:hover { background: #4752c4; }
.ich-btn-primary { background: var(--ich-blue); color: #fff; }
.ich-btn-primary:hover { background: var(--ich-blue-deep); }
.ich-btn-outline { background: transparent; color: var(--ich-blue); border: 1.5px solid var(--ich-blue); }
.ich-btn-outline:hover { background: #eef3fc; }

.ich-form { text-align: left; margin-top: 8px; }
.ich-field { margin-bottom: 16px; }
.ich-field label { display: block; font-size: 0.78rem; font-weight: 700; color: var(--ich-ink); margin-bottom: 6px; }
.ich-field input {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--ich-line); border-radius: 8px;
  font-size: 0.92rem; color: var(--ich-ink); background: var(--ich-white);
}
.ich-field input:focus { outline: none; border-color: var(--ich-blue); }

.ich-error {
  background: #fdeceb; border: 1px solid #f3b9b4; color: #8a1f16;
  border-radius: 8px; padding: 10px 14px; font-size: 0.84rem; margin-bottom: 18px; text-align: left;
}
.ich-error.is-shaking { animation: ichShake 0.4s ease; }
@keyframes ichShake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.ich-login-switch { margin-top: 24px; font-size: 0.82rem; color: var(--ich-ink-soft); }
.ich-login-switch a { color: var(--ich-blue); font-weight: 700; text-decoration: none; }
.ich-login-switch a:hover { text-decoration: underline; }

/* ---------- portal shell ---------- */

.ich-shell { display: flex; min-height: 100vh; }

.ich-sidebar {
  width: 260px; flex: 0 0 260px;
  background: var(--ich-blue-deep);
  color: #dbe4f7;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  animation: ichSidebarIn 0.3s ease;
}
@keyframes ichSidebarIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.ich-sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 20px; border-bottom: 1px solid rgba(255,255,255,0.12);
}
.ich-sidebar-brand img { width: 34px; height: 34px; border-radius: 50%; }
.ich-sidebar-brand strong { color: #fff; font-size: 1rem; display: block; }
.ich-sidebar-brand span { color: var(--ich-yellow); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

.ich-back-link {
  display: block; padding: 10px 20px; font-size: 0.76rem; font-weight: 700;
  color: #a9b9dd; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,0.12);
}
.ich-back-link:hover { color: #fff; }

/* #ichNav also carries staff.css's .view-toggle class (shared tab-switching
   JS in js/ich.js), whose horizontal inline-flex layout would otherwise
   turn the sidebar into a single-row tab strip -- override it back to a
   vertical list. */
.ich-nav.view-toggle { display: block; border: none; margin-bottom: 0; background: none; }
.ich-nav { list-style: none; margin: 0; padding: 14px 10px; flex: 1 1 auto; }
.ich-nav.view-toggle button, .ich-nav button, .ich-nav a {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; color: #dbe4f7; text-decoration: none;
  padding: 10px 12px; border-radius: 8px; font-size: 0.88rem; font-weight: 600; cursor: pointer;
  margin-bottom: 2px; text-transform: none; letter-spacing: normal;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.ich-nav.view-toggle button:hover, .ich-nav button:hover, .ich-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; transform: translateX(2px); }
.ich-nav.view-toggle button[aria-selected="true"], .ich-nav button[aria-selected="true"] { background: var(--ich-yellow); color: var(--ich-blue-deep); }
.ich-nav svg { width: 18px; height: 18px; flex: 0 0 auto; }

/* Collapsible sections — top-level (Assembly, Economic System, ...) and
   nested (Administration > EMS, > Discord Management, ...). A group toggle
   is styled like any other nav button (base rule above) plus these
   additions; its nested list's open/close height animates via the
   grid-template-rows 0fr/1fr technique, no JS height measurement needed. */
.ich-nav-group-toggle {
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  color: #7f93c2; justify-content: space-between;
}
.ich-nav-group-toggle:hover { color: #cdd9f2; transform: none; }
.ich-nav-group-toggle .ich-chevron { transition: transform 0.2s ease; }
.ich-nav-group.open > .ich-nav-group-toggle .ich-chevron { transform: rotate(90deg); }
.ich-nav-group-body {
  display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.25s ease;
}
.ich-nav-group.open > .ich-nav-group-body { grid-template-rows: 1fr; }
.ich-nav-group-body > .ich-nav-group-list { overflow: hidden; min-height: 0; list-style: none; margin: 0; padding: 0 0 0 6px; }
/* Nested groups (e.g. EMS inside Administration) get a subtler label size
   one level down, so the tree still reads top-to-bottom at a glance. */
.ich-nav-group-list .ich-nav-group-toggle { font-size: 0.64rem; }
.ich-nav .ich-go-external { opacity: 0.65; font-size: 0.78em; margin-left: auto; }

.ich-sidebar-user {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding: 16px 20px;
  display: flex; align-items: center; gap: 10px;
}
.ich-sidebar-user img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #fff; }
.ich-sidebar-user .ich-user-meta { flex: 1 1 auto; min-width: 0; }
.ich-sidebar-user strong { display: block; color: #fff; font-size: 0.84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ich-sidebar-user span { color: #a9b9dd; font-size: 0.72rem; }
.ich-sidebar-user a { color: var(--ich-yellow); font-size: 0.76rem; font-weight: 700; text-decoration: none; }
.ich-sidebar-user a:hover { text-decoration: underline; }

.ich-nav-toggle {
  display: none;
  position: fixed; top: 14px; left: 14px; z-index: 50;
  background: var(--ich-blue-deep); color: #fff; border: none; border-radius: 8px;
  padding: 10px 14px; font-weight: 700; font-size: 0.8rem; cursor: pointer;
}

.ich-main {
  flex: 1 1 auto; min-width: 0; min-height: 100vh; position: relative;
  background:
    radial-gradient(1100px 560px at 100% 0%, rgba(19, 80, 196, 0.07), transparent 60%),
    radial-gradient(900px 480px at 0% 100%, rgba(255, 199, 44, 0.06), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28'%3E%3Ccircle cx='1.5' cy='1.5' r='1.5' fill='%231350c4' fill-opacity='0.05'/%3E%3C/svg%3E"),
    var(--ich-white);
}
.ich-topbar {
  background: var(--ich-white); border-bottom: 1px solid var(--ich-line);
  padding: 22px 32px; position: relative;
}
.ich-topbar::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--ich-blue), var(--ich-yellow));
}
.ich-topbar .ich-eyebrow {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ich-blue); margin: 0 0 4px;
}
.ich-topbar h1 { margin: 0; font-size: 1.5rem; color: var(--ich-ink); }

.ich-content { padding: 28px 32px; }
.ich-panel { display: none; }
.ich-panel.active { display: block; animation: ichPanelIn 0.2s ease; }
@keyframes ichPanelIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* List items/summary tiles get a small hover lift (same pattern as .ich-card
   below) plus a brief staggered fade-in on first render, capped at the
   first handful of items so long lists don't feel sluggish. .res-item's
   base styling comes from css/staff.css (shared across staff pages) — these
   rules are scoped to .ich-content so they only ever apply inside the ICH. */
.ich-content .res-item, .ich-summary-item {
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  animation: ichPanelIn 0.25s ease both;
}
.ich-content .res-item:hover, .ich-summary-item:hover { box-shadow: 0 8px 20px rgba(19, 80, 196, 0.12); transform: translateY(-2px); }
.ich-content .res-item:nth-child(1), .ich-summary-item:nth-child(1) { animation-delay: 0.02s; }
.ich-content .res-item:nth-child(2), .ich-summary-item:nth-child(2) { animation-delay: 0.05s; }
.ich-content .res-item:nth-child(3), .ich-summary-item:nth-child(3) { animation-delay: 0.08s; }
.ich-content .res-item:nth-child(4), .ich-summary-item:nth-child(4) { animation-delay: 0.11s; }
.ich-content .res-item:nth-child(5), .ich-summary-item:nth-child(5) { animation-delay: 0.14s; }

.ich-toast {
  position: fixed; top: 18px; right: 18px; z-index: 60; max-width: 380px;
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--ich-blue-deep); color: #fff; border-left: 4px solid var(--ich-yellow);
  border-radius: 10px; padding: 14px 16px; box-shadow: 0 12px 32px rgba(11, 24, 48, 0.28);
  animation: ichToastIn 0.25s ease;
}
.ich-toast.is-out { animation: ichToastOut 0.25s ease forwards; }
.ich-toast p { margin: 0; font-size: 0.86rem; line-height: 1.4; flex: 1 1 auto; }
.ich-toast button {
  background: none; border: none; color: #dbe4f7; font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0;
}
.ich-toast button:hover { color: #fff; }
@keyframes ichToastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes ichToastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(24px); } }

.ich-card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-top: 8px;
}
.ich-card {
  display: block; background: var(--ich-white); border: 1px solid var(--ich-line); border-radius: 12px;
  padding: 20px; text-decoration: none; color: var(--ich-ink); border-top: 4px solid var(--ich-blue);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.ich-card:hover { box-shadow: 0 8px 22px rgba(19, 80, 196, 0.14); transform: translateY(-2px); }
.ich-card h3 { margin: 0 0 6px; font-size: 1.02rem; }
.ich-card p { margin: 0; color: var(--ich-ink-soft); font-size: 0.86rem; }
.ich-card .ich-go { display: inline-block; margin-top: 12px; font-size: 0.76rem; font-weight: 800; color: var(--ich-blue); text-transform: uppercase; letter-spacing: 0.04em; }

.ich-summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.ich-summary-item { background: #f4f7fd; border-radius: 12px; padding: 16px 18px; }
.ich-summary-item .label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ich-ink-soft); margin: 0 0 6px; }
.ich-summary-item .value { font-size: 1.1rem; font-weight: 700; color: var(--ich-ink); margin: 0; }

.ich-field-static { margin-bottom: 14px; }
.ich-field-static .label { font-size: 0.72rem; font-weight: 700; color: var(--ich-ink-soft); text-transform: uppercase; letter-spacing: 0.05em; }
.ich-field-static .value { font-size: 0.96rem; color: var(--ich-ink); margin-top: 2px; }

.ich-btn-small { padding: 9px 16px; font-size: 0.8rem; width: auto; display: inline-flex; }

/* .res-list/.res-item/.status.* now come from css/staff.css (also loaded
   by ich.html) instead of being redefined here — staff.css's version has
   more status variants (is-passed/is-archived) that every merged
   dashboard panel needs. */

@media (max-width: 860px) {
  .ich-nav-toggle { display: block; }
  .ich-sidebar {
    position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%);
    transition: transform 0.2s ease; box-shadow: 2px 0 24px rgba(0,0,0,0.25);
  }
  .ich-sidebar.open { transform: translateX(0); }
  .ich-topbar { padding: 22px 20px 22px 70px; }
  .ich-content { padding: 22px 20px; }
}
