:root {
  --bg: #f4f6fb; --panel: #ffffff; --ink: #1c2340; --muted: #6b7280; --line: #e5e8f0;
  --brand: #4f46e5; --brand-dark: #4338ca; --sidebar: #111633; --sidebar-ink: #c7cbe8;
  --green: #059669; --green-bg: #e7f6f0; --amber: #b45309; --amber-bg: #fdf3e3;
  --red: #dc2626; --red-bg: #fdeaea; --blue: #2563eb; --blue-bg: #e9f0fe; --gray-bg: #eef1f7;
  --shadow: 0 1px 3px rgba(16,24,40,.07), 0 1px 2px rgba(16,24,40,.05);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: Inter, system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; }
a { color: var(--brand); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#111633 0%,#2a2f6b 100%); padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 40px 36px; width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.login-card h1 { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); margin-bottom: 24px; font-size: 14px; }
.login-card input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; margin-bottom: 12px; font-family: inherit; }
.login-card input:focus { outline: 2px solid var(--brand); border-color: transparent; }
.login-card button { width: 100%; padding: 12px; background: var(--brand); color: #fff; border: 0; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; }
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 64px; }
.login-card .showbtn { position: absolute; top: 6px; right: 6px; width: auto; padding: 7px 10px; background: none; color: var(--brand); font-size: 13px; font-weight: 600; border: 0; }
.login-card .showbtn:hover { background: none; color: var(--brand-dark); }
.login-card button:hover { background: var(--brand-dark); }
.login-err { color: var(--red); font-size: 13px; margin-bottom: 10px; min-height: 16px; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 232px; background: var(--sidebar); color: var(--sidebar-ink); padding: 22px 14px; position: fixed; top: 0; bottom: 0; left: 0; display: flex; flex-direction: column; z-index: 20; }
.sidebar .logo { color: #fff; font-weight: 800; font-size: 19px; padding: 6px 12px 20px; letter-spacing: -.02em; }
.sidebar .logo span { color: #8b93ff; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: var(--sidebar-ink); text-decoration: none; font-weight: 500; font-size: 14px; margin-bottom: 3px; cursor: pointer; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item .ico { width: 19px; text-align: center; }
.sidebar .foot { margin-top: auto; padding: 12px; font-size: 12.5px; color: #8a8fbd; }
.sidebar .foot button { margin-top: 8px; width: 100%; background: rgba(255,255,255,.08); color: #dfe2ff; border: 0; padding: 8px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 13px; }
.main { flex: 1; min-width: 0; margin-left: 232px; padding: 28px 34px 60px; max-width: 1180px; }
.burger { display: none; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.page-head .hint { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.btn { background: var(--brand); color: #fff; border: 0; padding: 9px 16px; border-radius: 9px; font-weight: 600; font-size: 13.5px; cursor: pointer; font-family: inherit; }
.btn:hover { background: var(--brand-dark); }
.btn.ghost { background: var(--gray-bg); color: var(--ink); }
.btn.ghost:hover { background: #e2e6f0; }
.btn.small { padding: 6px 11px; font-size: 12.5px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--panel); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 25px; font-weight: 800; margin-top: 5px; letter-spacing: -.02em; }
.stat .s { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.panel { background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 18px; }
.panel h3 { font-size: 15.5px; font-weight: 700; margin-bottom: 12px; }
.panel .muted { color: var(--muted); font-size: 13.5px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-promised { background: var(--blue-bg); color: var(--blue); }
.b-writing { background: var(--green-bg); color: var(--green); }
.b-open { background: var(--amber-bg); color: var(--amber); }
.b-declined { background: var(--red-bg); color: var(--red); }
.b-answered { background: var(--gray-bg); color: #4b5563; }
.b-changed { background: #f3e8ff; color: #7c3aed; }
.b-suggested { background: var(--amber-bg); color: var(--amber); }

table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.list td { padding: 13px 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
table.list tr:last-child td { border-bottom: 0; }
.quote { background: var(--gray-bg); border-left: 3px solid #c7cbef; padding: 8px 12px; border-radius: 0 8px 8px 0; font-size: 13px; color: #3d4368; margin-top: 6px; }
.quote .who { font-weight: 600; font-size: 12px; color: var(--muted); margin-bottom: 2px; }

.grid-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 14px; }
.doc { background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.doc .ic { width: 40px; height: 40px; border-radius: 10px; background: var(--blue-bg); display: flex; align-items: center; justify-content: center; font-size: 19px; }
.doc .t { font-weight: 600; font-size: 14.5px; }
.doc .m { color: var(--muted); font-size: 12.5px; }
.doc .row { display: flex; gap: 8px; margin-top: 4px; }

.grid-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px,1fr)); gap: 12px; }
.ph { border-radius: 12px; overflow: hidden; background: #dfe3ee; aspect-ratio: 3/4; cursor: pointer; position: relative; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .cap { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,.72)); color: #fff; font-size: 11.5px; padding: 18px 9px 7px; }
.lightbox { position: fixed; inset: 0; background: rgba(10,12,28,.9); z-index: 50; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 26px; }
.lightbox img { max-width: 94vw; max-height: 80vh; border-radius: 10px; }
.lightbox .c { color: #fff; margin-top: 12px; font-size: 14px; text-align: center; max-width: 640px; }
.lightbox .x { position: absolute; top: 16px; right: 22px; color: #fff; font-size: 26px; cursor: pointer; background: none; border: 0; }
.lightbox .nav { position: absolute; top: 50%; transform: translateY(-50%); color: #fff; font-size: 34px; cursor: pointer; background: rgba(255,255,255,.12); border: 0; border-radius: 99px; width: 48px; height: 48px; }
.lightbox .prev { left: 14px; } .lightbox .next { right: 14px; }

.roomgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px,1fr)); gap: 14px; }
.room { background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); padding: 18px; }
.room .n { font-weight: 700; font-size: 15.5px; }
.room .d { color: var(--brand); font-weight: 700; font-size: 19px; margin: 6px 0 4px; }
.room .m { color: var(--muted); font-size: 13px; line-height: 1.5; white-space: pre-line; }

.modal-bg { position: fixed; inset: 0; background: rgba(17,22,51,.45); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 16px; padding: 26px; width: 100%; max-width: 480px; max-height: 88vh; overflow: auto; }
.modal h3 { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.modal label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
.modal input, .modal select, .modal textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; font-family: inherit; }
.modal textarea { min-height: 76px; resize: vertical; }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #111633; color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 14px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: 14px; }
.loading { display: flex; min-height: 100vh; align-items: center; justify-content: center; color: var(--muted); }
.iconbtns { display: flex; gap: 6px; }
.iconbtns button { background: var(--gray-bg); border: 0; border-radius: 7px; padding: 5px 9px; cursor: pointer; font-size: 12.5px; font-family: inherit; }
.iconbtns button.danger { color: var(--red); }

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.4); }
  .main { margin-left: 0; padding: 18px 16px 60px; }
  .panel { overflow-x: auto; padding: 16px 16px; }
  table.list td, table.list th { padding: 10px 8px; font-size: 13px; }
  .burger { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 7px 12px; font-size: 17px; cursor: pointer; margin-bottom: 14px; }
}
