:root {
  --bg: var(--tg-theme-bg-color, #0f0f10);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #171719);
  --text: var(--tg-theme-text-color, #f5f5f5);
  --hint: var(--tg-theme-hint-color, #92929b);
  --accent: var(--tg-theme-button-color, #7b2638);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, #c77486);
  --border: rgba(127,127,127,.22);
  --card: color-mix(in srgb, var(--secondary-bg) 90%, transparent);
  --danger: #d95757;
  --warning: #d99c45;
  --success: #4da86a;
  --blue: #5a8ed8;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { padding: env(safe-area-inset-top) 0 calc(88px + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.app-shell { max-width: 1180px; margin: 0 auto; padding: 18px 16px 26px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 21px; letter-spacing: -.02em; }
h2 { font-size: clamp(25px, 5vw, 38px); letter-spacing: -.035em; }
h3 { font-size: 17px; }
.eyebrow { color: var(--hint); font-size: 10px; font-weight: 800; letter-spacing: .14em; margin-bottom: 4px; }
.muted { color: var(--hint); }
.profile-chip { border: 1px solid var(--border); background: var(--card); border-radius: 999px; display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; max-width: 180px; }
.profile-chip span:first-child { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 800; }
.profile-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.hero-card { border: 1px solid var(--border); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 24%, var(--card)), var(--card) 58%); border-radius: 24px; padding: 22px; display: flex; justify-content: space-between; gap: 18px; align-items: end; }
.hero-card p { margin-top: 8px; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn, .icon-btn, .text-button { border: 0; cursor: pointer; }
.btn { background: var(--secondary-bg); border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px; font-weight: 700; }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn-danger { background: color-mix(in srgb, var(--danger) 18%, var(--secondary-bg)); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.btn-small { padding: 8px 11px; font-size: 12px; }
.icon-btn { min-width: 38px; height: 38px; border-radius: 11px; background: var(--secondary-bg); border: 1px solid var(--border); font-size: 20px; }
.text-button { background: none; color: var(--link); font-weight: 700; font-size: 13px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin: 14px 0; }
.stat-card { padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -.04em; }
.stat-label { color: var(--hint); font-size: 12px; margin-top: 4px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.panel { border: 1px solid var(--border); background: var(--card); border-radius: var(--radius); padding: 16px; min-width: 0; }
.panel-head, .section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head { margin-bottom: 12px; }
.stack-list, .cards-list { display: flex; flex-direction: column; gap: 8px; }
.list-row { border-top: 1px solid var(--border); padding: 11px 0 3px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.list-row:first-child { border-top: 0; padding-top: 0; }
.row-title { font-weight: 750; line-height: 1.2; }
.row-meta { font-size: 12px; color: var(--hint); margin-top: 4px; line-height: 1.4; }
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 4px 8px; background: var(--secondary-bg); border: 1px solid var(--border); font-size: 11px; white-space: nowrap; }
.badge-urgent, .badge-overdue { color: #ff8585; }
.badge-review { color: #8ab6ff; }
.badge-success { color: #82d69a; }
.chips-wrap { display: flex; gap: 7px; flex-wrap: wrap; }
.chip { padding: 7px 9px; border-radius: 999px; background: var(--secondary-bg); border: 1px solid var(--border); font-size: 12px; }
.view { display: none; }
.view.active { display: block; animation: enter .16s ease; }
@keyframes enter { from { opacity: .55; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.section-title-row { margin: 8px 0 15px; }
.calendar-controls { display: flex; align-items: center; gap: 6px; }
.filter-row { display: flex; gap: 8px; margin-bottom: 12px; }
.input { width: 100%; color: var(--text); background: var(--secondary-bg); border: 1px solid var(--border); border-radius: 11px; padding: 11px 12px; outline: none; }
.input:focus { border-color: color-mix(in srgb, var(--accent) 70%, white); }
textarea.input { min-height: 88px; resize: vertical; }
.week-label { font-size: 13px; color: var(--hint); margin: 10px 0; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(120px,1fr)); gap: 7px; overflow-x: auto; padding-bottom: 4px; }
.calendar-day { min-height: 320px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 10px; }
.calendar-day.today { border-color: color-mix(in srgb, var(--accent) 70%, white); }
.day-head { position: sticky; top: 0; background: var(--card); padding-bottom: 8px; z-index: 1; }
.day-name { color: var(--hint); font-size: 10px; text-transform: uppercase; font-weight: 800; letter-spacing: .08em; }
.day-number { font-size: 22px; font-weight: 800; }
.event { border-left: 3px solid var(--accent); background: var(--secondary-bg); border-radius: 9px; padding: 8px; margin-top: 6px; font-size: 11px; }
.event-shoot { border-left-color: var(--success); }
.event-task { border-left-color: var(--warning); }
.event-shoot_deadline { border-left-color: var(--blue); }
.event-announcement { border-left-color: #b77ce5; }
.event-time { color: var(--hint); font-weight: 700; font-size: 10px; margin-bottom: 3px; }
.event-title { font-weight: 750; line-height: 1.25; }
.event-meta { color: var(--hint); margin-top: 3px; line-height: 1.2; }
.segmented { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; }
.segmented button { border: 1px solid var(--border); background: var(--secondary-bg); border-radius: 999px; padding: 8px 11px; white-space: nowrap; }
.segmented button.active { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.entity-card { border: 1px solid var(--border); background: var(--card); border-radius: var(--radius); padding: 15px; }
.entity-head { display: flex; justify-content: space-between; gap: 12px; }
.entity-title { font-size: 16px; font-weight: 800; }
.entity-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.entity-description { color: var(--hint); font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.entity-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.team-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.team-card { display: flex; align-items: center; gap: 11px; padding: 14px; border: 1px solid var(--border); background: var(--card); border-radius: var(--radius); }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--secondary-bg); display: grid; place-items: center; font-weight: 850; flex: 0 0 auto; }
.team-name { font-weight: 800; }
.team-role, .team-username { font-size: 12px; color: var(--hint); margin-top: 2px; }
.bottom-nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(8px, env(safe-area-inset-bottom)); width: min(calc(100% - 20px), 620px); display: grid; grid-template-columns: repeat(5,1fr); padding: 6px; border: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(18px); border-radius: 19px; z-index: 20; box-shadow: 0 10px 35px rgba(0,0,0,.25); }
.bottom-nav button { border: 0; background: none; color: var(--hint); padding: 6px 3px; display: flex; flex-direction: column; gap: 2px; align-items: center; border-radius: 13px; }
.bottom-nav button.active { background: var(--secondary-bg); color: var(--text); }
.bottom-nav span { font-size: 18px; line-height: 1; }
.bottom-nav small { font-size: 9px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.62); z-index: 50; display: grid; align-items: end; }
.modal { width: min(100%, 720px); max-height: 92vh; overflow-y: auto; margin: 0 auto; border: 1px solid var(--border); background: var(--bg); border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 11px; font-weight: 750; color: var(--hint); }
.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; max-height: 220px; overflow-y: auto; }
.check-card { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 11px; padding: 9px; background: var(--secondary-bg); font-size: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.banner { border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; font-size: 13px; }
.banner-error { background: color-mix(in srgb, var(--danger) 18%, var(--secondary-bg)); border: 1px solid color-mix(in srgb, var(--danger) 55%, transparent); }
.banner-success { background: color-mix(in srgb, var(--success) 18%, var(--secondary-bg)); border: 1px solid color-mix(in srgb, var(--success) 55%, transparent); }
.loading-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; align-content: center; gap: 12px; background: var(--bg); font-size: 11px; letter-spacing: .14em; font-weight: 800; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 22px 10px; text-align: center; color: var(--hint); font-size: 13px; }
.hidden { display: none !important; }
@media (max-width: 760px) {
  .app-shell { padding: 14px 12px 24px; }
  .hero-card { align-items: stretch; flex-direction: column; }
  .hero-actions { justify-content: flex-start; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .two-column { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: 1fr; }
  .calendar-grid { grid-template-columns: repeat(7, 148px); }
  .calendar-day { min-height: 260px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.full { grid-column: auto; }
  .checkbox-grid { grid-template-columns: 1fr; }
  .section-title-row { align-items: end; }
  .section-title-row .btn { font-size: 12px; padding: 9px 10px; }
}
