:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: rgba(255, 255, 255, .045);
  --panel-solid: #121110;
  --line: rgba(255, 255, 255, .09);
  --text: #f5f0e3;
  --muted: #9a9281;
  --accent: #d4af37;
  --gold-light: #f6e3a1;
  --accent-soft: rgba(212, 175, 55, .14);
  --danger: #ef4444;
  --radius: 16px;
}

* { box-sizing: border-box; }
body {
  margin: 0; color: var(--text); font: 15px/1.45 Inter, system-ui, sans-serif; min-height: 100vh;
  background:
    radial-gradient(900px 600px at 0% 0%, rgba(212, 175, 55, .14), transparent 60%),
    radial-gradient(800px 600px at 100% 100%, rgba(184, 137, 43, .12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h2 { font-size: 20px; }
code { background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; }
.hint { color: var(--muted); margin: 4px 0 0; font-size: 14px; }
[hidden] { display: none !important; }

.logo-word {
  font-family: Sora, Inter, sans-serif; font-weight: 800; letter-spacing: .14em; font-size: 20px;
  background: linear-gradient(180deg, #f6e3a1, #e9c46a 55%, #b8892b); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Glass surfaces */
.glass, .card, .person, .item {
  background: linear-gradient(135deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .025));
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 10px 30px rgba(0, 0, 0, .35);
  border-radius: var(--radius);
}

input, select, textarea {
  width: 100%; font: inherit; color: inherit; background: rgba(0, 0, 0, .45);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; outline: none;
}
select option { background: #121110; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); min-width: 0; }
label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-weight: 500; font-size: 14px; }
label.check input { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
label.inline { flex-direction: row; align-items: center; gap: 10px; }
label.inline select { width: auto; }

.btn {
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .05); color: var(--text);
  padding: 9px 14px; border-radius: 10px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(180deg, #e9c46a, #b8892b); border-color: #d4af37; color: #0a0805; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn.primary:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 9px; font-size: 13px; }
.icon-btn { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 6px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--accent-soft); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); padding: 30px; display: grid; gap: 14px; }
.login-card .logo-word { font-size: 28px; }
.error { color: var(--danger); margin: 0; min-height: 1em; font-size: 14px; }

/* Top bar */
.bar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(5, 5, 5, .7); -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 20px; padding: 10px 24px; flex-wrap: wrap;
}
.bar-title { display: flex; align-items: center; gap: 12px; }
.mode { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--gold-light); }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tabs button { font: inherit; font-weight: 600; border: none; background: none; color: var(--muted); padding: 8px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.tabs button.active { background: var(--accent-soft); color: var(--gold-light); }
.bar-actions { display: flex; gap: 8px; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 28px 24px 80px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 0 0 14px; flex-wrap: wrap; }
.card + .section-head, .list + .section-head { margin-top: 32px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { padding: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.list { display: grid; gap: 10px; }
.empty { color: var(--muted); padding: 22px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }

/* Deals */
.deal-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: end; }
.deal-form button { height: 40px; }
.item { padding: 12px 14px; display: grid; gap: 10px; align-items: end; }
.item.deal { grid-template-columns: repeat(5, 1fr) auto; }
.item.deal .actions { grid-column: 6; grid-row: 1 / span 2; }
.deal-form input:disabled, .item input:disabled { opacity: .45; }
.item .actions { display: flex; gap: 2px; align-items: center; }

/* People */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.person { padding: 16px; display: grid; gap: 14px; }
.person.inactive { opacity: .5; }
.person-top { display: grid; grid-template-columns: 76px 1fr auto; gap: 14px; align-items: center; }
.photo {
  width: 76px; height: 76px; border-radius: 50%; overflow: hidden; cursor: pointer; position: relative; padding: 0;
  display: grid; place-items: center; font: 700 24px Sora, Inter, sans-serif; color: #e9c46a;
  background: linear-gradient(145deg, #2b2416, #110f0a); border: 2px solid rgba(212, 175, 55, .5);
}
.photo.square { border-radius: 16px; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo::after { content: '📷'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; background: rgba(0, 0, 0, .5); opacity: 0; transition: opacity .15s; }
.photo:hover::after, .photo:focus-visible::after { opacity: 1; }
.busy { opacity: .5; pointer-events: none; }
.person-fields { display: grid; gap: 6px; }
.person-fields input:first-child { font-weight: 600; }
.person-side { display: flex; flex-direction: column; }
.person-nums { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; align-items: end; }
.stepper { display: flex; gap: 4px; }
.stepper input { min-width: 0; }
.stat-line { font-size: 13px; color: var(--muted); }
.stat-line b { color: var(--gold-light); }

/* Teams */
.item.team { grid-template-columns: 76px 1.4fr 1.4fr 1fr auto; align-items: center; }
.team-members { grid-column: 2 / -1; font-size: 13px; color: var(--muted); }

/* Projects */
.item.project { grid-template-columns: 240px 1fr auto; align-items: start; gap: 18px; padding: 16px; }
.project-art { display: grid; gap: 8px; }
.proj-img {
  width: 240px; height: 140px; border-radius: 12px; overflow: hidden; cursor: pointer; padding: 0;
  border: 1px dashed var(--accent); background: linear-gradient(135deg, #2b2416, #0d0b07); color: var(--accent);
  font: 600 13px Inter, sans-serif; display: grid; place-items: center;
}
.proj-img img { width: 100%; height: 100%; object-fit: cover; }
.dev-logo-row { display: flex; align-items: center; gap: 8px; }
.dev-logo {
  width: 110px; height: 44px; border-radius: 8px; border: 1px dashed var(--line); background: rgba(0, 0, 0, .4); cursor: pointer;
  display: grid; place-items: center; color: var(--muted); font: 600 12px Inter, sans-serif; padding: 4px; overflow: hidden;
}
.dev-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.project-fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.project-fields .wide { grid-column: span 2; }
.project-fields .full { grid-column: 1 / -1; }
.item .actions.col { flex-direction: column; }

/* Messages */
.item.text { grid-template-columns: 1fr auto; align-items: center; }
.item.quote { grid-template-columns: 1fr 170px auto; align-items: center; }

/* Settings */
.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.settings > .check, .logo-field, .slide-toggles { grid-column: 1 / -1; }
.logo-field > span, .slide-toggles > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.logo-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.logo-preview { width: 140px; height: 56px; border: 1px dashed var(--line); border-radius: 10px; display: grid; place-items: center; background: #000; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 20;
  background: linear-gradient(180deg, #e9c46a, #b8892b); color: #0a0805; padding: 10px 18px; border-radius: 10px; font-weight: 700; transition: .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); color: #fff; }

@media (max-width: 1000px) {
  .item.deal { grid-template-columns: 1fr 1fr; }
  .item.deal .actions { grid-column: auto; grid-row: auto; justify-content: flex-end; }
  .deal-form { grid-template-columns: 1fr 1fr; }
  .item.project { grid-template-columns: 1fr; }
  .project-fields { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .bar { padding: 10px 16px; }
  .wrap { padding: 20px 16px 80px; }
  .grid-2, .deal-form, .people { grid-template-columns: 1fr; }
  .item.team { grid-template-columns: 64px 1fr; }
  .item.quote { grid-template-columns: 1fr; }
}
