﻿@import url("https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&display=swap");

:root {
  --ink: #1c1917;
  --ink-soft: #57534e;
  --paper: #f3eee6;
  --card: #fffdf9;
  --line: #e8e0d4;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #ccfbf1;
  --accent: #ea580c;
  --accent-soft: #ffedd5;
  --ok: #047857;
  --warn: #b45309;
  --danger: #b91c1c;
  --shadow: 0 18px 40px -24px rgba(28, 25, 23, .35);
  --radius: 22px;
  --sidebar: 268px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Be Vietnam Pro", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  line-height: 1.5;
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; }
button, input, select, textarea { font-family: inherit; }

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  background: linear-gradient(180deg, #134e4a 0%, #0f172a 100%);
  color: #ecfdf5;
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 22px;
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, #2dd4bf, #0f766e);
  display: grid; place-items: center;
  font-weight: 800; color: #fff; box-shadow: 0 8px 20px rgba(45, 212, 191, .35);
}
.brand-logo {
  display: block;
  height: 44px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  object-position: left center;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}
.sidebar .brand { align-items: flex-start; flex-wrap: wrap; }
.sidebar .brand-logo {
  height: 40px;
  max-width: 100%;
  background: #fff;
  border-radius: 10px;
  padding: 6px 8px;
  box-sizing: content-box;
}
.guest-hero .brand { padding-left: 0; align-items: flex-start; }
.guest-hero .brand-logo { height: 72px; max-width: 420px; }
.role-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.role-art { width: 76px; height: 64px; display: block; }
.brand b { display: block; font-size: 18px; letter-spacing: .02em; }
.brand small { opacity: .7; font-size: 12px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  color: #d1fae5; padding: 11px 12px; border-radius: 14px;
  margin-bottom: 4px; font-weight: 500;
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-user {
  margin-top: auto; padding: 12px; border-radius: 16px;
  background: rgba(255,255,255,.08);
  display: flex; gap: 10px; align-items: center;
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover; background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 700; overflow: hidden; flex-shrink: 0;
}
.avatar.lg { width: 72px; height: 72px; font-size: 28px; }
.sidebar-user .meta { min-width: 0; }
.sidebar-user .meta b, .sidebar-user .meta span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .meta span { opacity: .7; font-size: 12px; }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 28px 0;
}
.page { padding: 18px 28px 48px; }
.h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: -.03em; }
.sub { color: var(--ink-soft); margin: 0 0 22px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.stat, .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat { padding: 18px 20px; }
.stat .k { color: var(--ink-soft); font-size: 13px; }
.stat .v { font-size: 28px; font-weight: 800; margin-top: 4px; }
a.stat { color: inherit; text-decoration: none; display: block; }
a.stat:hover { border-color: var(--brand); }
.stat-link { display: inline-block; margin-top: 8px; color: var(--brand-dark); font-weight: 700; font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 99px; background: #a8a29e; display: inline-block; margin-right: 6px; }
.dot.on { background: #059669; box-shadow: 0 0 0 3px #d1fae5; }
.card { padding: 22px; }
.card h3 { margin: 0 0 14px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.stat-line {
  display: flex; align-items: center; gap: 16px; flex-wrap: nowrap;
  margin: 0 0 16px; min-width: 0;
}
.stat-line .h1 { margin: 0; font-size: 26px; white-space: nowrap; flex: 0 0 auto; }
.stat-picks {
  display: grid; grid-template-columns: repeat(3, 200px); gap: 10px;
  align-items: center;
}
.stat-picks select,
.stat-picks .btn {
  width: 200px; height: 44px; min-height: 44px; margin: 0;
  padding: 0 14px; border: 0; outline: 0; box-shadow: none;
  border-radius: 12px; font-size: 15px; font-weight: 600; line-height: 44px;
  appearance: none; -webkit-appearance: none;
}
.stat-picks select {
  color: var(--ink); background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='none' stroke='%2357534e' stroke-width='1.6' stroke-linecap='round' d='M2.5 5 L7 9.5 L11.5 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px;
}
.stat-picks .btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; cursor: pointer;
}

.btn, .btn-ghost, .btn-danger, .btn-accent {
  border: 0; cursor: pointer; border-radius: 14px;
  padding: 10px 16px; font: inherit; font-weight: 600; font-size: 15px; line-height: 1.2;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn { background: var(--brand); color: #fff; }
a.btn:hover, .btn:hover { background: var(--brand-dark); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
a.btn-accent:hover, .btn-accent:hover { background: #c2410c; color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
a.btn-ghost:hover, .btn-ghost:hover { color: var(--ink); background: #fff; }
.btn-danger { background: #fff1f2; color: var(--danger); }
a.btn-danger:hover, .btn-danger:hover { color: var(--danger); background: #ffe4e6; }
.btn.sm, .btn-ghost.sm, .btn-danger.sm { padding: 7px 11px; font-size: 13px; border-radius: 11px; }

.table-wrap { overflow: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
table.data tr:hover td { background: #faf7f1; }

.badge, .badge-ok, .badge-warn, .badge-muted, .badge-accent {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge { background: var(--brand-soft); color: var(--brand-dark); }
.badge-ok { background: #d1fae5; color: var(--ok); }
.badge-warn { background: var(--accent-soft); color: var(--warn); }
.badge-muted { background: #e7e5e4; color: #57534e; }
.badge-accent { background: var(--accent-soft); color: var(--accent); }

.form { display: grid; gap: 14px; }
.profile-actions {
    display: flex; justify-content: flex-start;
    margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--line);
}
.profile-actions .btn { min-height: 44px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; font-size: 15px;
}
.field textarea { min-height: 110px; resize: vertical; }
.hint { color: var(--ink-soft); font-size: 13px; margin-top: 4px; }
.alert { padding: 12px 14px; border-radius: 14px; margin-bottom: 14px; font-weight: 500; }
.alert-ok { background: #d1fae5; color: #065f46; }
.alert-err { background: #ffe4e6; color: #9f1239; }
.validation-summary-errors, .field-validation-error { color: var(--danger); font-size: 13px; }

.choice-row {
  display: grid; grid-template-columns: 90px 1fr 180px auto; gap: 10px; align-items: end;
  padding: 12px; border: 1px dashed var(--line); border-radius: 16px; margin-bottom: 10px; background: #fff;
}
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; cursor: zoom-in; background: #f5f5f4; }
.assignee-box { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; padding: 8px; background: #fff; }
.assignee-item { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; }
.assignee-item:hover { background: #faf7f1; }

.bar { height: 10px; background: #f5f5f4; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #2dd4bf); }

.share { display: flex; gap: 8px; }
.share input { flex: 1; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); }

.guest-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr;
  background: radial-gradient(1200px 500px at 10% -10%, #99f6e4, transparent), var(--paper);
}
.guest-hero { padding: 64px; display: flex; flex-direction: column; justify-content: center; }
.guest-hero h1 { font-size: 48px; line-height: 1.1; margin: 12px 0 16px; letter-spacing: -.04em; }
.guest-form {
  display: flex; align-items: center; justify-content: center; padding: 32px;
}
.login-card { width: 100%; max-width: 420px; background: var(--card); border-radius: 28px; padding: 32px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.login-brand { display: none; }

.viewer { background: #fff; border: 2px solid var(--line); border-radius: 24px; overflow: hidden; }
.viewer.is-picked { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(15,118,110,.15); }
.viewer-top { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; }
.viewer-img { width: 100%; max-height: 420px; object-fit: contain; background: #f5f5f4; display: block; cursor: zoom-in; }
.viewer-empty { height: 180px; display: grid; place-items: center; font-size: 42px; font-weight: 800; background: var(--brand-soft); color: var(--brand-dark); }
.viewer-body { padding: 16px 18px 20px; }
.viewer-body h2 { margin: 4px 0 10px; font-size: 20px; }
.viewer-nav { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.viewer-nav form, .viewer-nav .vote-pick { flex: 1; }
.viewer-nav .btn, .viewer-nav .btn-danger, .viewer-nav .btn-ghost { width: 100%; justify-content: center; white-space: nowrap; padding: 10px 8px; font-size: 14px; }
.vote-screen .h1 { font-size: 22px; }
.vote-screen .sub { margin-bottom: 0; font-size: 13px; }
.vote-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.pick-bar {
  position: sticky; top: 0; z-index: 24;
  display: flex; justify-content: flex-end;
  margin: 0 0 10px; padding: 8px 0;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.mobile-app .pick-bar {
  top: 56px;
  margin-left: -16px; margin-right: -16px;
  padding-left: 16px; padding-right: 16px;
}
.pick-chip {
  flex-shrink: 0; background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--ink-soft);
  box-shadow: 0 8px 18px -14px rgba(28, 25, 23, .7);
}
.pick-chip b { color: var(--brand-dark); font-size: 15px; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vote-finish { margin-top: 16px; }
.vote-finish .btn { width: 100%; justify-content: center; }
.vote-finish .btn:disabled { opacity: .45; cursor: not-allowed; }
.vote-finish .hint { text-align: center; margin: 8px 0 0; }
.choice-tile {
  position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden; color: inherit; box-shadow: var(--shadow);
}
.choice-open { display: block; color: inherit; }
.choice-open:hover, .choice-tile:hover { color: inherit; border-color: var(--brand); }
.choice-act { padding: 0 10px 10px; }
#lang-table input { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.choice-act .btn, .choice-act .btn-danger { width: 100%; justify-content: center; }
.choice-tile.is-picked { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,118,110,.16); }
.choice-tile img, .choice-fallback { width: 100%; height: 132px; object-fit: cover; display: block; background: #f5f5f4; }
.choice-fallback { display: grid; place-items: center; font-weight: 800; font-size: 22px; color: var(--brand-dark); background: var(--brand-soft); }
.choice-check {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 14px;
}
.choice-cap { padding: 8px 10px 10px; }
.choice-cap b { display: block; font-size: 12px; color: var(--ink-soft); }
.choice-cap span {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; font-size: 13px; font-weight: 600; line-height: 1.35;
}
.vote-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.vote-card {
  background: #fff; border: 2px solid var(--line); border-radius: 20px; overflow: hidden; cursor: pointer;
  transition: .2s transform, .2s border-color;
}
.vote-card:hover { transform: translateY(-3px); }
.vote-card.selected { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(15,118,110,.15); }
.vote-card img { width: 100%; height: 180px; object-fit: cover; display: block; }
.vote-card .body { padding: 12px 14px 16px; }
.vote-card .ma { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.lightbox {
  position: fixed; inset: 0; background: rgba(28,25,23,.82); display: none;
  align-items: center; justify-content: center; z-index: 50; padding: 24px;
}
.lightbox.open { display: flex; }
.pager { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.pager a, .pager span.active {
  min-width: 36px; height: 36px; padding: 0 10px; display: inline-grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600;
}
.pager span.active, .pager a:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.chart-box { max-width: 520px; margin: 0 auto; }
.lightbox img { max-width: min(96vw, 980px); max-height: 90vh; border-radius: 16px; }

.mobile-app { background: var(--paper); }
.app-header {
  position: sticky; top: 0; z-index: 30;
  background: #fffdf9; border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 24px -18px rgba(28, 25, 23, .55);
}
.app-header-inner {
  max-width: 480px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 14px;
}
.app-header .brand { padding: 0; min-width: 0; flex: 1; overflow: hidden; gap: 8px; }
.app-header .brand-logo { height: 30px; max-width: 108px; }
.app-header .brand > div { min-width: 0; }
.app-header .brand b, .app-header .brand small {
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px;
}
.app-header .brand b { font-size: 14px; }
.app-header .brand small { font-size: 11px; }
.app-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.app-header-actions .avatar { display: none; }
.mobile-shell { max-width: 480px; margin: 0 auto; min-height: calc(100vh - 64px); background: var(--paper); padding: 16px 16px 96px; }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #fffdf9; border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
.bottom-nav a { color: var(--ink-soft); font-size: 11px; text-align: center; padding: 6px; font-weight: 600; }
.bottom-nav a.active, .bottom-nav a:hover { color: var(--brand); }
.bottom-nav i { display: block; font-size: 20px; margin-bottom: 2px; }
.tile { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; margin-bottom: 12px; color: inherit; }
.tile:hover { color: inherit; border-color: var(--brand); }

.dash-hero {
  background: linear-gradient(155deg, #134e4a 0%, #0f766e 62%, #0e7490 100%);
  color: #fff; border-radius: 28px; padding: 20px 18px 16px; margin-bottom: 16px;
  box-shadow: 0 18px 36px -22px rgba(15, 118, 110, .9);
}
.dash-hero h1 { color: #fff; font-size: 26px; margin: 4px 0 6px; letter-spacing: -.03em; }
.dash-hero p { margin: 0; opacity: .88; font-size: 14px; }
.dash-kicker { font-size: 12px; letter-spacing: .02em; opacity: .8; }
.dash-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.dash-stat { background: rgba(255,255,255,.14); border-radius: 16px; padding: 10px 6px; text-align: center; }
.dash-stat b { display: block; font-size: 22px; line-height: 1.1; }
.dash-stat span { display: block; font-size: 11px; opacity: .86; margin-top: 2px; }
.seg { display: flex; gap: 8px; margin: 0 0 14px; }
.seg a {
  flex: 1; text-align: center; padding: 8px 6px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); font-weight: 600; font-size: 13px; color: var(--ink);
}
.seg a.active, .seg a.active:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.act-card {
  display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: 22px; padding: 14px; margin-bottom: 12px; color: inherit; box-shadow: var(--shadow);
}
.act-card:hover { color: inherit; border-color: var(--brand); }
.act-ico {
  width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center;
  font-size: 22px; flex-shrink: 0;
}
.act-ico.vote { background: var(--brand-soft); color: var(--brand-dark); }
.act-ico.idea { background: var(--accent-soft); color: var(--accent); }
.act-body { min-width: 0; flex: 1; }
.act-body > b { display: block; margin: 6px 0 2px; font-size: 16px; }
.act-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.act-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--ink-soft); }
.empty-card { text-align: center; padding: 28px 18px; }
.empty-card i { font-size: 36px; color: var(--brand); display: block; margin-bottom: 8px; }

@media (max-width: 980px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; }
  .guest-wrap { grid-template-columns: 1fr; }
  .guest-hero { display: none; }
  .guest-form { padding: 20px 16px; }
  .login-card { padding: 24px 20px; }
  .login-brand { display: block; margin-bottom: 20px; }
  .login-brand .brand {
    padding: 0; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0;
  }
  .login-brand .brand-logo { height: auto; width: auto; max-width: 100%; max-height: 44px; }
  .login-brand .brand > div { min-width: 0; max-width: 100%; }
  .login-brand .brand b { font-size: 20px; line-height: 1.25; }
  .login-brand .brand small { display: block; line-height: 1.4; }
  .choice-row { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .page, .topbar { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}
