:root {
  --ink: #172126;
  --muted: #6b7580;
  --line: #dce4e8;
  --panel: #ffffff;
  --page: #eef3f5;
  --accent: #16877d;
  --accent-strong: #0d625d;
  --gold: #d9aa34;
  --warning: #b85c00;
  --danger: #b42318;
  --success: #247a3d;
  --soft: #e6f4f1;
  --shadow: 0 18px 55px rgba(19, 32, 42, 0.16);
  --sidebar-open: 260px;
  --sidebar-closed: 76px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.88), rgba(238,243,245,0.92)),
    var(--page);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-shell {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 430px) 1fr;
  background:
    linear-gradient(90deg, rgba(247,250,250,0.98), rgba(247,250,250,0.82) 42%, rgba(247,250,250,0.14)),
    url("https://images.unsplash.com/photo-1511578314322-379afb476865?auto=format&fit=crop&w=1800&q=80") center / cover;
  animation: login-pan 22s ease-in-out infinite alternate;
}

.login-shell::before,
.login-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-shell::before {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.16) 0 1px, transparent 1px 76px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.12) 0 1px, transparent 1px 76px);
  mask-image: linear-gradient(90deg, transparent 0%, #000 44%, #000 100%);
  animation: grid-drift 14s linear infinite;
}

.login-shell::after {
  background: linear-gradient(110deg, transparent 18%, rgba(217,170,52,0.18) 42%, transparent 62%);
  transform: translateX(-48%);
  animation: access-sweep 7s ease-in-out infinite;
}

.login-panel {
  position: relative;
  z-index: 1;
  align-self: center;
  margin: 32px;
  padding: 30px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  animation: panel-enter 520ms ease-out both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.brand.login-brand {
  display: grid;
  justify-items: start;
  gap: 14px;
}

.login-title {
  display: grid;
  gap: 4px;
}

.brand-logo {
  display: block;
  width: 190px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.login-logo {
  width: min(240px, 100%);
}

.sidebar-logo {
  width: 150px;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,0.25));
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.15;
}

h2 {
  font-size: 21px;
}

h3 {
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.check-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid #cbd7dd;
  border-radius: 8px;
  background: #fff;
}

.check-row {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
}

.check-row input {
  width: auto;
}

label {
  color: #3b434b;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd7dd;
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

textarea {
  min-height: 116px;
  resize: vertical;
}

textarea.auto-grow {
  overflow: hidden;
  resize: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(15, 123, 123, 0.18);
  border-color: var(--accent);
  box-shadow: 0 10px 28px rgba(18, 85, 81, 0.12);
}

.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink);
  background: #fff;
  border-color: #cbd3db;
  white-space: nowrap;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, border-color 150ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(23, 33, 38, 0.12);
}

.btn.primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.btn.primary:hover {
  background: var(--accent-strong);
}

.btn.danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.btn.icon {
  width: 40px;
  padding: 0;
}

.error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-closed) minmax(0, 1fr);
  transition: grid-template-columns 220ms ease;
}

.app-shell:has(.sidebar:hover),
.app-shell:has(.sidebar:focus-within),
.app-shell.menu-open {
  grid-template-columns: var(--sidebar-open) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(22,135,125,0.18), transparent 28%),
    #121b20;
  color: #fff;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid rgba(255,255,255,0.08);
}

.sidebar .brand {
  align-items: flex-start;
  flex-direction: column;
  gap: 8px;
  min-height: 94px;
  overflow: hidden;
}

.sidebar .brand h2,
.sidebar .brand .muted,
.nav-label,
.user-details {
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 180ms ease, transform 180ms ease;
  white-space: nowrap;
}

.app-shell:has(.sidebar:hover) .sidebar .brand h2,
.app-shell:has(.sidebar:hover) .sidebar .brand .muted,
.app-shell:has(.sidebar:hover) .nav-label,
.app-shell:has(.sidebar:hover) .user-details,
.app-shell:has(.sidebar:focus-within) .sidebar .brand h2,
.app-shell:has(.sidebar:focus-within) .sidebar .brand .muted,
.app-shell:has(.sidebar:focus-within) .nav-label,
.app-shell:has(.sidebar:focus-within) .user-details,
.app-shell.menu-open .sidebar .brand h2,
.app-shell.menu-open .sidebar .brand .muted,
.app-shell.menu-open .nav-label,
.app-shell.menu-open .user-details {
  opacity: 1;
  transform: translateX(0);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  width: 100%;
  border: 0;
  border-radius: 10px;
  min-height: 46px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #dbe5e8;
  background: transparent;
  text-align: left;
  overflow: hidden;
  position: relative;
}

.nav button::before {
  content: "";
  flex: 0 0 5px;
  width: 5px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255,255,255,0.28);
}

.nav button.active,
.nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
}

.nav button.active::before,
.nav button:hover::before {
  background: var(--gold);
}

.user-box {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.18);
  display: grid;
  gap: 12px;
  overflow: hidden;
}

.logout-btn {
  justify-content: flex-start;
  overflow: hidden;
}

.mobile-logout-btn {
  display: none;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 72px;
  padding: 16px 24px;
  background: rgba(255,255,255,0.86);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  backdrop-filter: blur(14px);
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.notify-ready {
  border-color: #cfe5d5;
  color: var(--success);
  background: #edf8ef;
}

.content {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(30, 42, 54, 0.06);
}

.panel-head {
  min-height: 56px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-head.compact {
  min-height: 0;
  padding: 0 0 12px;
  border-bottom: 0;
}

.panel-body {
  padding: 16px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.stat {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(30, 42, 54, 0.06);
}

.stat strong {
  display: block;
  font-size: 28px;
  margin-top: 6px;
}

.calendar-view-control,
.calendar-filter-control {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.calendar-filter-control {
  width: 100%;
  margin-left: 0;
  justify-content: flex-end;
}

.calendar-view-control > span,
.calendar-filter-control > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.calendar-view-toggle,
.calendar-filter-toggle {
  padding: 3px;
  display: inline-flex;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f8f8;
  flex-wrap: wrap;
}

.calendar-view-toggle button,
.calendar-filter-toggle button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.calendar-view-toggle button.active,
.calendar-filter-toggle button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 3px rgba(30, 42, 54, 0.12);
}

.filter-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent);
}

.filter-dot.start {
  background: #2f8f4e;
}

.filter-dot.running {
  background: #e8842f;
}

.filter-dot.setup {
  background: #b42318;
}

.filter-dot.teardown {
  background: #d9aa34;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(92px, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.weekday,
.day {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.weekday {
  min-height: 36px;
  padding: 9px;
  color: var(--muted);
  background: #f0f4f4;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.day {
  min-height: 126px;
  padding: 8px;
  background: #fff;
  transition: background 160ms ease;
}

.day:hover {
  background: #fbfdfd;
}

.day.out {
  background: #f7f9fa;
  color: #a3abb3;
}

.day-number {
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 800;
}

.agenda-day-label {
  display: none;
}

.event-chip {
  width: 100%;
  border: 0;
  border-left: 4px solid var(--accent);
  border-radius: 5px;
  padding: 7px;
  margin-bottom: 6px;
  background: var(--soft);
  text-align: left;
  white-space: normal;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.event-chip.active {
  border-left-color: #e8842f;
  background: #fff0df;
}

.event-chip.completed {
  border-left-color: #7b8790;
  background: #eef2f4;
}

.event-chip.start {
  border-left-color: #2f8f4e;
  background: #e5f6e9;
}

.event-chip.running {
  border-left-color: #e8842f;
  background: #fff0df;
}

.event-chip.setup {
  border-left-color: #b42318;
  background: #fff0ed;
}

.event-chip.teardown {
  border-left-color: #d9aa34;
  background: #fff3c7;
}

.event-chip.updated {
  border-left-color: #b42318;
  background: #fff0ed;
  box-shadow: 0 8px 20px rgba(180, 35, 24, 0.18);
  animation: event-attention 1.6s ease-in-out infinite;
}

.event-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(22, 135, 125, 0.16);
}

.event-chip strong {
  display: block;
  font-size: 12px;
}

.event-chip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.event-chip small {
  display: none;
}

.calendar-list {
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  border: 0;
}

.calendar-list .day {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.calendar-list .day-number {
  margin: 4px 0 8px;
  color: var(--ink);
  font-size: 13px;
  text-transform: capitalize;
}

.calendar-list .calendar-day-number {
  display: none;
}

.calendar-list .agenda-day-label {
  display: block;
}

.calendar-list .event-chip {
  min-height: 76px;
  padding: 13px 14px;
  margin-bottom: 0;
  border-radius: 10px;
  border-left-width: 6px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(30, 42, 54, 0.08);
}

.calendar-list .event-chip strong {
  font-size: 16px;
  line-height: 1.25;
}

.calendar-list .event-chip span {
  margin-top: 4px;
  font-size: 13px;
}

.calendar-list .event-chip small {
  display: block;
  margin-top: 7px;
  color: #55626b;
  font-size: 12px;
  font-weight: 800;
}

.event-grid-view {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.event-grid-card {
  min-height: 140px;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  box-shadow: 0 10px 24px rgba(30, 42, 54, 0.07);
}

.event-grid-card.active {
  border-left-color: #d9aa34;
  background: #fff8dc;
}

.event-grid-card.completed {
  border-left-color: #2f8f4e;
  background: #eef9f1;
}

.event-grid-card.updated {
  border-left-color: #b42318;
  background: #fff0ed;
  box-shadow: 0 10px 26px rgba(180, 35, 24, 0.16);
  animation: event-attention 1.6s ease-in-out infinite;
}

.event-grid-card span,
.event-grid-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.event-grid-card strong {
  font-size: 16px;
  line-height: 1.25;
}

.event-grid-card em {
  color: #4f5c64;
  font-style: normal;
}

.event-grid-empty {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

.agenda-empty {
  display: none;
}

.notification-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 50;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.notification-toast {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cfe1dd;
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 14px 34px rgba(30, 42, 54, 0.18);
  text-align: left;
  pointer-events: auto;
  animation: panel-enter 180ms ease-out both;
}

.notification-toast strong,
.notification-toast span {
  display: block;
}

.notification-toast strong {
  margin-bottom: 4px;
}

.notification-toast span {
  color: var(--muted);
  line-height: 1.35;
}

.chat-panel {
  min-height: calc(100vh - 150px);
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto;
  overflow: hidden;
}

.chat-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(246, 250, 250, 0.78), rgba(255, 255, 255, 0.96)),
    #f7fafb;
}

.chat-switcher {
  padding: 12px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.chat-current {
  display: grid;
  gap: 2px;
}

.chat-current h2 {
  margin: 0;
  font-size: 18px;
}

.chat-current .muted {
  font-size: 12px;
}

.compact-field {
  margin: 0;
}

.compact-field label {
  font-size: 11px;
}

.chat-message {
  display: flex;
  justify-content: flex-start;
}

.chat-message.own {
  justify-content: flex-end;
}

.chat-bubble {
  max-width: min(680px, 78%);
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(30, 42, 54, 0.06);
}

.chat-message.own .chat-bubble {
  border-color: #cde7e3;
  background: #e8f7f3;
}

.chat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 5px;
}

.chat-meta strong {
  font-size: 13px;
}

.chat-meta span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.chat-bubble p {
  margin: 0;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-attachment {
  margin-top: 8px;
  padding: 9px 10px;
  display: grid;
  gap: 2px;
  border: 1px solid rgba(22, 135, 125, 0.22);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  text-decoration: none;
}

.chat-attachment strong {
  overflow-wrap: anywhere;
}

.chat-attachment span {
  color: var(--muted);
  font-size: 12px;
}

.chat-empty {
  margin: auto;
  color: var(--muted);
  text-align: center;
}

.chat-form {
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.chat-form textarea {
  min-height: 48px;
  border-radius: 12px;
  resize: vertical;
}

.file-btn {
  min-height: 44px;
  padding: 10px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #44505a;
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.file-btn input {
  display: none;
}

.chat-file-preview {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.chat-form .error {
  grid-column: 1 / -1;
  margin: 0;
}

@keyframes login-pan {
  from {
    background-position: center center;
    background-size: 100% auto;
  }
  to {
    background-position: 58% center;
    background-size: 106% auto;
  }
}

@keyframes grid-drift {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(76px, 76px, 0);
  }
}

@keyframes access-sweep {
  0%,
  100% {
    transform: translateX(-52%);
    opacity: 0;
  }
  42%,
  58% {
    opacity: 1;
  }
  80% {
    transform: translateX(52%);
    opacity: 0;
  }
}

@keyframes event-attention {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-1px);
  }
}

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.event-sheet-layout {
  display: grid;
  gap: 14px;
}

.sheet-cell {
  padding: 16px;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(30, 42, 54, 0.05);
}

.sheet-cell h3 {
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #edf1f3;
  color: var(--ink);
  font-size: 16px;
}

.sheet-cell .field {
  margin-bottom: 0;
}

.sheet-cell .center-info {
  margin: 0;
}

.sheet-event-main textarea,
.sheet-cell textarea[name="produzione"],
.sheet-cell textarea[name="evento"] {
  min-height: 170px;
}

.event-tech-row {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(260px, 4fr);
  gap: 14px;
  align-items: start;
}

.sheet-technical-main,
.sheet-service-print {
  align-self: start;
}

.sheet-detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sheet-phase-grid {
  grid-template-columns: 1fr;
}

.event-photos-section .muted {
  margin: 0;
}

.photo-upload-btn {
  min-height: 42px;
  width: fit-content;
  padding: 9px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd3db;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.photo-upload-btn input {
  display: none;
}

.photo-upload-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.event-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.event-photo-card {
  margin: 0;
  padding: 8px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbfb;
}

.event-photo-preview {
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: zoom-in;
}

.event-photo-card img,
.photo-lightbox img {
  display: block;
}

.event-photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 7px;
  background: #fff;
}

.event-photo-card figcaption {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  padding: 16px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  background: rgba(8, 13, 16, 0.88);
}

.photo-lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #fff;
}

.photo-lightbox img {
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}

.event-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.event-choice-card {
  min-height: 150px;
  padding: 18px;
  display: grid;
  align-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  box-shadow: 0 10px 26px rgba(30, 42, 54, 0.07);
}

.event-choice-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(30, 42, 54, 0.12);
}

.event-choice-card strong {
  font-size: 18px;
}

.event-choice-card span {
  color: var(--muted);
  line-height: 1.35;
}

.closure-source-list {
  display: grid;
  gap: 10px;
}

.closure-source-card {
  width: 100%;
  min-height: 82px;
  padding: 13px 14px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-left: 6px solid #d9aa34;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.closure-source-card span,
.closure-source-card small {
  color: var(--muted);
}

.tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px;
  background: #e9eef1;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tabs button {
  border: 0;
  border-radius: 6px;
  padding: 10px 13px;
  color: #44505a;
  background: transparent;
  font-weight: 800;
}

.tabs button.active,
.tabs button:hover {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 2px rgba(30, 42, 54, 0.08);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.row-actions {
  width: 1%;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f4;
  color: #3a454d;
  font-size: 12px;
  font-weight: 800;
}

.badge.admin {
  background: #fff1ce;
  color: #775000;
}

.badge.viewer {
  background: #e8f3ff;
  color: #18517d;
}

.center-info {
  margin: 0 0 14px;
  padding: 12px;
  display: grid;
  gap: 4px;
  background: #f1f6f6;
  border: 1px solid #d4e5e3;
  border-radius: 8px;
}

.center-info span {
  color: var(--muted);
  font-size: 13px;
}

.center-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn.small {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
  text-decoration: none;
}

.center-filter {
  margin-bottom: 8px;
}

.sheet-hero {
  background:
    linear-gradient(135deg, rgba(22, 135, 125, 0.12), rgba(217, 170, 52, 0.14)),
    #fff;
}

.viewer-sheet {
  display: grid;
  gap: 14px;
}

.mobile-sheet-summary {
  display: none;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.detail-item {
  min-height: 74px;
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.detail-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-item strong {
  font-size: 14px;
  line-height: 1.3;
}

.phase-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.phase-card {
  min-height: 120px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.phase-card h3 {
  margin-bottom: 8px;
}

.phase-card p {
  margin: 0;
  color: #3d4850;
  line-height: 1.45;
  white-space: pre-wrap;
}

.client-area {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.client-area-body {
  display: grid;
  gap: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12, 20, 24, 0.58);
}

.modal-window {
  width: min(980px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.hidden {
  display: none !important;
}

@media print {
  @page {
    margin: 12mm;
  }

  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    background: #fff !important;
    color: #000;
  }

  html,
  body {
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
  }

  body > *:not(.print-sheet) {
    display: none !important;
  }

  .print-sheet {
    display: block !important;
    position: static !important;
    width: 100% !important;
    min-height: auto !important;
    overflow: visible !important;
    font-family: Arial, Helvetica, sans-serif;
    color: #000;
  }

  .print-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #222;
  }

  .print-logo {
    width: 180px;
    height: auto;
  }

  .print-head h1 {
    margin: 0;
    font-size: 22px;
  }

  .print-head p {
    margin: 4px 0 0;
    color: #555;
  }

  .print-summary {
    margin-top: 14px;
    padding: 10px;
    border: 2px solid #222;
    break-inside: avoid;
  }

  .print-summary h2 {
    margin: 0 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #999;
    font-size: 14px;
    text-transform: uppercase;
  }

  .print-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 12px;
  }

  .print-summary-grid div {
    min-height: 34px;
  }

  .print-summary-grid span {
    display: block;
    margin-bottom: 4px;
    color: #555;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .print-summary-grid strong {
    font-size: 13px;
    line-height: 1.25;
  }

  .print-notes {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    grid-template-columns: 1fr;
  }

  .print-notes article {
    padding: 8px 10px;
    border: 1px solid #999;
    break-inside: avoid;
  }

  .print-notes h2 {
    margin: 0 0 4px;
    font-size: 13px;
  }

  .print-notes p {
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 900px) {
  .login-shell,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell:has(.sidebar:hover),
  .app-shell:has(.sidebar:focus-within),
  .app-shell.menu-open {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    overflow: visible;
    z-index: 5;
    padding: 14px;
  }

  .sidebar .brand h2,
  .sidebar .brand .muted,
  .nav-label,
  .user-details {
    opacity: 1;
    transform: none;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav button {
    justify-content: center;
    font-size: 13px;
  }

  .user-box {
    display: none;
  }

  .stats,
  .detail-grid,
  .phase-grid,
  .check-list,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .calendar-list {
    grid-template-columns: 1fr;
  }

  .calendar-list .weekday {
    display: none;
  }

  .calendar-list .day {
    min-height: 96px;
  }

  .calendar-list .day.out {
    display: none;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }

  .calendar-grid .weekday {
    display: block;
    min-height: 28px;
    padding: 6px 2px;
    font-size: 10px;
    text-align: center;
  }

  .calendar-grid .day {
    min-height: 72px;
    padding: 4px;
  }

  .calendar-grid .day.out {
    display: block;
  }

  .calendar-grid .day-number {
    margin-bottom: 4px;
    font-size: 11px;
  }

  .calendar-grid .event-chip {
    min-height: 0;
    padding: 4px;
    margin-bottom: 3px;
    border-left-width: 3px;
    border-radius: 4px;
  }

  .calendar-grid .event-chip strong {
    font-size: 10px;
    line-height: 1.15;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .calendar-grid .event-chip span,
  .calendar-grid .event-chip small {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 560px) {
  body {
    background: #f4f7f8;
  }

  .login-shell {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    padding: 18px;
    background:
      linear-gradient(180deg, rgba(247,250,250,0.96), rgba(247,250,250,0.84)),
      url("https://images.unsplash.com/photo-1511578314322-379afb476865?auto=format&fit=crop&w=1200&q=75") center / cover;
  }

  .login-shell::before,
  .login-shell::after {
    display: none;
  }

  .login-panel {
    width: 100%;
    margin: 0;
    padding: 22px;
    border-radius: 12px;
  }

  .login-logo {
    width: min(210px, 100%);
  }

  .brand.login-brand {
    gap: 12px;
    margin-bottom: 20px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
  }

  .sidebar .brand {
    min-height: 0;
    margin-bottom: 0;
    gap: 0;
  }

  .sidebar .brand h2,
  .sidebar .brand .muted {
    display: none;
  }

  .sidebar-logo {
    width: 118px;
  }

  .nav {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
  }

  .nav button {
    width: auto;
    min-height: 38px;
    padding: 7px 9px;
  }

  .nav-label {
    display: none;
  }

  .content,
  .topbar {
    padding: 12px;
  }

  .topbar {
    min-height: 0;
    align-items: flex-start;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .mobile-logout-btn {
    display: inline-flex;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .topbar .muted {
    display: none;
  }

  .stats {
    display: none;
  }

  .notification-stack {
    top: auto;
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
  }

  .notification-toast {
    padding: 11px 12px;
  }

  .panel {
    border-radius: 10px;
  }

  .chat-panel {
    min-height: calc(100dvh - 120px);
    grid-template-rows: auto minmax(220px, 1fr) auto;
  }

  .chat-body {
    padding: 12px;
  }

  .chat-switcher {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 12px;
  }

  .chat-current h2 {
    font-size: 17px;
  }

  .chat-bubble {
    max-width: 92%;
  }

  .chat-form {
    position: sticky;
    bottom: 0;
    grid-template-columns: 1fr 1fr;
    padding: 10px;
  }

  .chat-form textarea {
    grid-column: 1 / -1;
  }

  .chat-form .btn {
    min-height: 44px;
  }

  .panel-head {
    min-height: 48px;
    padding: 12px;
  }

  .panel-head h2 {
    font-size: 18px;
    text-transform: capitalize;
  }

  .calendar-view-control,
  .calendar-filter-control {
    width: 100%;
    margin-left: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .calendar-view-toggle,
  .calendar-filter-toggle {
    width: 100%;
  }

  .calendar-view-toggle button,
  .calendar-filter-toggle button {
    flex: 1;
  }

  .calendar-list {
    display: grid;
    gap: 12px;
    border: 0;
  }

  .calendar-list .day {
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .calendar-list .day-number {
    margin: 4px 0 8px;
    color: var(--ink);
    font-size: 13px;
    text-transform: capitalize;
  }

  .calendar-list .calendar-day-number {
    display: none;
  }

  .calendar-list .agenda-day-label {
    display: block;
  }

  .calendar-list .day:not(.has-events) {
    display: none;
  }

  .calendar-list .event-chip {
    min-height: 76px;
    padding: 13px 14px;
    margin-bottom: 8px;
    border-radius: 10px;
    border-left-width: 6px;
    background: #fff;
    box-shadow: 0 8px 18px rgba(30, 42, 54, 0.08);
  }

  .calendar-list .event-chip strong {
    font-size: 16px;
    line-height: 1.25;
  }

  .calendar-list .event-chip span {
    margin-top: 4px;
    font-size: 13px;
  }

  .calendar-list .event-chip small {
    display: block;
    margin-top: 7px;
    color: #55626b;
    font-size: 12px;
    font-weight: 800;
  }

  .agenda-empty {
    display: block;
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    color: var(--muted);
    background: #fff;
    text-align: center;
  }

  .modal {
    position: fixed;
    inset: 0;
    display: block;
    padding: 0;
    background: #fff;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .modal-window {
    width: 100%;
    min-height: 100dvh;
    max-height: none;
    overflow: visible;
    border-radius: 0;
    box-shadow: none;
  }

  .modal .panel-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
  }

  .modal .panel-body {
    padding: 12px;
    padding-bottom: 86px;
  }

  .viewer-sheet {
    gap: 10px;
  }

  .viewer-sheet > .detail-grid,
  .viewer-sheet > .center-info {
    display: none;
  }

  .mobile-sheet-summary {
    display: grid;
    gap: 10px;
  }

  .mobile-sheet-card,
  .mobile-place-card {
    display: grid;
    gap: 5px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
  }

  .mobile-sheet-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .mobile-sheet-card span,
  .mobile-place-card span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .mobile-sheet-card strong,
  .mobile-place-card strong {
    color: var(--ink);
    font-size: 16px;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .mobile-place-card p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.35;
  }

  .mobile-maps-btn {
    width: 100%;
    margin-top: 5px;
    min-height: 48px;
    text-decoration: none;
  }

  .detail-grid,
  .phase-grid {
    gap: 8px;
  }

  .event-tech-row,
  .sheet-detail-grid,
  .event-choice-grid {
    grid-template-columns: 1fr;
  }

  .event-photo-grid {
    grid-template-columns: 1fr;
  }

  .sheet-cell {
    padding: 12px;
    border-radius: 10px;
  }

  .phase-grid {
    grid-template-columns: 1fr;
  }

  .detail-item,
  .phase-card,
  .client-area,
  .center-info {
    border-radius: 10px;
  }

  .phase-card {
    min-height: 0;
    padding: 12px;
  }

  .phase-card h3 {
    font-size: 14px;
  }

  .phase-card p {
    font-size: 14px;
  }

  .client-area {
    margin-top: 0;
    padding: 12px;
  }

  .modal-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #fff;
  }

  .modal-actions .btn {
    width: 100%;
  }

  textarea {
    min-height: 96px;
  }

  .table {
    display: block;
    overflow-x: auto;
  }
}
