/* EY Events Hub — same light-corporate design system as EY Tender Radar (shared tokens), trimmed
   to what this app actually uses: no charts/competitors/archive panels. */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface2: #fbfbfd; --raised: #ffffff;
  --line: #e6e8ee; --line2: #eef0f4;
  --tx: #1b2230; --tx2: #5a6474; --tx3: #97a0af;
  --accent: #3b5bdb; --accent-hover: #2f4bc4; --accent-soft: #eef1fd; --accent-tx: #ffffff;
  --ey: #ffe600;
  --good: #2f9e57; --good-soft: #e7f4ec;
  --warn: #c98a1a; --warn-soft: #fbf1de;
  --bad: #d64545; --bad-soft: #fbe9e9;
  --info: #3b5bdb; --slate: #8a93a3;
  --radius: 10px; --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(20,26,45,.05);
  --shadow: 0 6px 24px rgba(20,26,45,.10);
  --sb: 236px; --fs: 13.5px;
}
:root[data-theme="dark"] {
  --bg: #14161c; --surface: #1b1e26; --surface2: #191c23; --raised: #21252f;
  --line: #2b2f3a; --line2: #262a33;
  --tx: #e8eaf0; --tx2: #9aa2b1; --tx3: #6b7280;
  --accent: #6b8afd; --accent-hover: #7f9bff; --accent-soft: #222842; --accent-tx: #0e1424;
  --good: #46c479; --good-soft: #16281f; --warn: #e0a53a; --warn-soft: #2a2113;
  --bad: #f06060; --bad-soft: #2c1717; --info: #6b8afd; --slate: #7b8494;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 10px 34px rgba(0,0,0,.45);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif; background: var(--bg); color: var(--tx); font-size: var(--fs); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tnum { font-variant-numeric: tabular-nums; }

.logomark { display: inline-block; width: 22px; height: 22px; border-radius: 6px; background: var(--ey); position: relative; flex: none; }
.logomark::before { content: ""; position: absolute; left: 5px; top: 6px; right: 5px; height: 2.2px; border-radius: 2px; background: #2e2e38; box-shadow: 0 5px 0 #2e2e38, 0 10px 0 #2e2e38; }

/* Login */
.login { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(900px 500px at 70% -10%, var(--accent-soft), var(--bg)); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 34px 30px; width: min(370px, 92vw); box-shadow: var(--shadow); text-align: center; }
.login-logo { font-size: 20px; font-weight: 700; display: flex; gap: 10px; align-items: center; justify-content: center; }
.login-sub { color: var(--tx2); font-size: 12px; margin: 10px 0 22px; line-height: 1.5; }
.login-card input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); color: var(--tx); font-size: 15px; }
.login-card input + input { margin-top: 10px; }
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-card button { width: 100%; margin-top: 12px; padding: 12px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-tx); font-weight: 600; font-size: 15px; }
.login-card button:hover { background: var(--accent-hover); }
.login-err { color: var(--bad); font-size: 13px; min-height: 18px; margin-top: 10px; }

/* Shell */
.app { display: grid; grid-template-columns: var(--sb) 1fr; height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px; gap: 4px; }
.brand { font-weight: 700; font-size: 15px; padding: 4px 10px 16px; display: flex; gap: 10px; align-items: center; letter-spacing: -.01em; }
.nav { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; flex: 1; }
.nav .group { color: var(--tx3); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; padding: 16px 12px 5px; }
.nav button { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--tx2); font-size: 13px; }
.nav button:hover { background: var(--surface2); color: var(--tx); }
.nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav button.active .icon { stroke: var(--accent); }
.nav button .badge { margin-left: auto; background: var(--line2); color: var(--tx2); font-size: 11px; font-weight: 600; border-radius: 20px; padding: 1px 8px; min-width: 22px; text-align: center; }
.nav button.active .badge { background: var(--accent); color: var(--accent-tx); }
.nav button .badge.warn { background: var(--bad); color: #fff; }
.side-foot { display: flex; gap: 6px; align-items: center; padding-top: 12px; border-top: 1px solid var(--line); }
.whoami { color: var(--tx3); font-size: 11.5px; margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ghost { background: transparent; border: 1px solid var(--line); color: var(--tx2); border-radius: 8px; padding: 7px 9px; display: inline-flex; align-items: center; justify-content: center; }
.ghost:hover { color: var(--tx); border-color: var(--tx3); background: var(--surface2); }

/* Main */
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 26px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar h1 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.poll-info { color: var(--tx3); font-size: 11.5px; margin-top: 3px; }
.poll-info.warn { color: var(--warn); }
.top-actions { display: flex; gap: 10px; align-items: center; }
.search { width: min(300px, 34vw); padding: 9px 13px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface2); color: var(--tx); }
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.content { padding: 22px 26px; overflow-y: auto; flex: 1; }

/* KPI cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 15px 16px; box-shadow: var(--shadow-sm); }
.card .k { color: var(--tx2); font-size: 12px; }
.card .v { font-size: 25px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.card.accent .v { color: var(--accent); }
.card.warn .v { color: var(--warn); }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--tx2); border-radius: 8px; padding: 6px 12px; font-size: 12.5px; }
.chip:hover { color: var(--tx); border-color: var(--tx3); }
.chip.active { background: var(--accent); color: var(--accent-tx); border-color: var(--accent); font-weight: 600; }
.fsel { border: 1px solid var(--line); background: var(--surface); color: var(--tx); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; }
.fsel:focus { outline: none; border-color: var(--accent); }
.clearf { color: var(--tx3); font-size: 12px; padding: 6px 4px; }
.clearf:hover { color: var(--tx); }

/* Country code badge */
.cc { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 22px; padding: 0 7px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .03em; background: var(--line2); color: var(--tx2); border: 1px solid var(--line); }
.cc.KZ { background: #eaf1fb; color: #2a5fb0; border-color: #d6e4f7; }
.cc.UZ { background: #e9f5ee; color: #2b7d4c; border-color: #d3ecdb; }
.cc.KG { background: #fdeeee; color: #b8443f; border-color: #f6dada; }
.cc.TJ { background: #f5eefc; color: #7a45c0; border-color: #e9dcf7; }
.cc.TM { background: #eafaf7; color: #1c8a7a; border-color: #d3f0ea; }
.cc.AZ { background: #e8f4fb; color: #1f6f9f; border-color: #cfe6f5; }
.cc.AM { background: #f2eefc; color: #6b45c0; border-color: #e6dcf7; }
.cc.GE { background: #fbeff3; color: #a3324f; border-color: #f3d5dd; }
:root[data-theme="dark"] .cc { background: var(--raised); color: var(--tx2); border-color: var(--line); }

/* Table */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: auto; background: var(--surface); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 15px; border-bottom: 1px solid var(--line2); font-size: 13px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
th { color: var(--tx3); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; position: sticky; top: 0; background: var(--surface); cursor: pointer; user-select: none; z-index: 1; }
th:hover { color: var(--tx2); }
th.nosort { cursor: default; }
tbody tr.datarow { cursor: pointer; transition: background .1s; }
tbody tr.datarow:hover { background: var(--surface2); }
td.title-cell { white-space: normal; max-width: 420px; }
td.title-cell b { font-weight: 600; }
td.title-cell .sub { color: var(--tx3); font-size: 11.5px; display: block; margin-top: 2px; }
tr.month-row td { background: var(--surface2); color: var(--tx3); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; padding: 8px 15px; cursor: default; }

/* Engagement tags */
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 2px 7px; font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.tag.pick { background: var(--surface2); color: var(--tx2); border: 1px solid var(--line); cursor: pointer; }
.tag.pick.on { background: var(--accent); color: var(--accent-tx); border-color: var(--accent); }

/* Source badge */
.srcbadge { display: inline-block; border-radius: 6px; padding: 2px 8px; font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.srcbadge.search { background: var(--accent-soft); color: var(--accent); }
.srcbadge.calendar { background: var(--good-soft); color: var(--good); }
.srcbadge.instagram { background: #fbe9f3; color: #c22b7a; }
.srcbadge.xlsx { background: var(--line2); color: var(--tx2); }
.srcbadge.manual { background: var(--warn-soft); color: var(--warn); }
:root[data-theme="dark"] .srcbadge.instagram { background: #3a1f2c; color: #f090c0; }

.flag { display: inline-block; font-size: 10.5px; font-weight: 600; border-radius: 5px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; white-space: nowrap; background: var(--warn-soft); color: var(--warn); }

/* Status / decision selects in the row */
.status-sel { border: 1px solid var(--line); background: var(--surface2); color: var(--tx); border-radius: 7px; padding: 5px 9px; font-size: 12px; }
.status-sel:focus { outline: none; border-color: var(--accent); }
.status-sel.st-Confirmed { color: var(--good); }
.status-sel.st-Tentative { color: var(--tx2); }
.status-sel.st-Delayed { color: var(--warn); }
.status-sel.st-Cancelled { color: var(--bad); }
.owner-in { border: 1px solid var(--line); background: var(--surface2); color: var(--tx); border-radius: 7px; padding: 5px 9px; font-size: 12px; width: 90px; }
.owner-in:focus { outline: none; border-color: var(--accent); }

/* Review-queue action buttons in the row */
.rev-actions { display: flex; gap: 6px; }
.rev-btn { border: 1px solid var(--line); background: var(--surface); color: var(--tx2); border-radius: 7px; padding: 5px 10px; font-size: 12px; font-weight: 600; }
.rev-btn.accept { background: var(--good-soft); color: var(--good); border-color: transparent; }
.rev-btn.accept:hover { background: var(--good); color: #fff; }
.rev-btn.reject { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.rev-btn.reject:hover { background: var(--bad); color: #fff; }

.muted { color: var(--tx3); }
.empty { color: var(--tx3); text-align: center; padding: 54px; }

/* Drawer (view/edit/add) */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(20,26,45,.38); backdrop-filter: blur(1px); }
.drawer-panel { position: absolute; right: 0; top: 0; height: 100%; width: min(560px, 95vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow); overflow-y: auto; padding: 24px 26px; animation: slidein .18s ease; }
@keyframes slidein { from { transform: translateX(24px); opacity: .5; } to { transform: none; opacity: 1; } }
.drawer-panel h2 { margin: 0 34px 4px 0; font-size: 18px; line-height: 1.4; font-weight: 650; }
.dw-meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.pill { background: var(--surface2); border: 1px solid var(--line); border-radius: 7px; padding: 4px 10px; font-size: 12px; color: var(--tx2); }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.dw-section { margin-top: 20px; }
.dw-section .lbl { color: var(--tx3); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 7px; }
.dw-section p { margin: 0; line-height: 1.6; color: var(--tx); }
.dw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.dw-grid.wide { grid-template-columns: 1fr; }
.fld { display: grid; gap: 4px; }
.fld label { font-size: 10.5px; color: var(--tx3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.fld input, .fld select, .fld textarea { border: 1px solid var(--line); background: var(--surface2); color: var(--tx); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px; width: 100%; }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.notes, textarea.notes { width: 100%; min-height: 84px; border: 1px solid var(--line); background: var(--surface2); color: var(--tx); border-radius: 10px; padding: 10px 12px; font: inherit; resize: vertical; }
.notes:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.save-row { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.btn { background: var(--accent); color: var(--accent-tx); border: 0; border-radius: 9px; padding: 9px 16px; font-weight: 600; }
.btn:hover { background: var(--accent-hover); }
.btn.secondary { background: var(--surface2); color: var(--tx2); border: 1px solid var(--line); }
.btn.secondary:hover { color: var(--tx); border-color: var(--tx3); }
.btn.good { background: var(--good); }
.btn.good:hover { background: #268448; }
.btn.bad { background: var(--bad); }
.btn.bad:hover { background: #b83a3a; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 6px 0 6px 13px; color: var(--tx2); font-size: 12.5px; border-left: 2px solid var(--line); }
.close-x { position: absolute; top: 18px; right: 20px; font-size: 20px; line-height: 1; color: var(--tx3); background: none; border: 0; }
.close-x:hover { color: var(--tx); }
.save-msg { color: var(--good); font-size: 12px; }
.save-msg.err { color: var(--bad); }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: 220px; transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: none; }
  .search { width: 40vw; }
  .dw-grid { grid-template-columns: 1fr; }
}
