* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f6f7f9; --panel: #ffffff; --panel2: #f3f4f6; --border: #e5e7eb; --border2: #eeeeee;
  --text: #111827; --muted: #6b7280; --accent: #2563eb; --accent2: #2563eb; --accent-soft: #dbeafe;
  --green: #059669; --red: #dc2626; --yellow: #b45309; --orange: #ea580c;
  --sidebar: #fafafa;
}
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }

.btn { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 9px 16px; font-size: 14px; font-weight: 600; transition: background .15s; }
.btn:hover { background: #1d4ed8; }
.btn.secondary { background: #ffffff; border: 1px solid var(--border); color: var(--text); }
.btn.secondary:hover { background: var(--panel2); }
.btn.danger { background: var(--red); }
.btn.small { padding: 5px 10px; font-size: 12px; }

input, select, textarea {
  background: #ffffff; border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 9px 12px; font-size: 14px; font-family: inherit; width: 100%;
}
input::placeholder { color: #9ca3af; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; font-weight: 600; }

.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--sidebar); border-right: 1px solid var(--border2); padding: 20px 12px; flex-shrink: 0; }
.sidebar h1 { font-size: 17px; padding: 0 10px 18px; color: var(--text); }
.sidebar nav button {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; background: none; border: none;
  color: var(--muted); padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 2px;
  transition: background .12s, color .12s;
}
.sidebar nav button .ti { font-size: 17px; flex-shrink: 0; }
.sidebar h1 { display: flex; align-items: center; gap: 8px; }
.sidebar h1 .ti { color: var(--accent); font-size: 20px; }
.ti { vertical-align: -2px; }
.sidebar nav button:hover { background: #f0f1f3; color: var(--text); }
.sidebar nav button.active { background: var(--accent); color: #ffffff; }
.sidebar .userbox { margin-top: 24px; padding: 12px; border-top: 1px solid var(--border2); font-size: 13px; color: var(--muted); }

.main { flex: 1; padding: 24px 28px; overflow-x: auto; }
.main h2 { font-size: 20px; margin-bottom: 18px; font-weight: 600; }
.section { display: none; }
.section.active { display: block; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 22px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.card .label { font-size: 11px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.card .value { font-size: 26px; font-weight: 700; }
.card .value.green { color: var(--green); }
.card .value.red { color: var(--red); }
.card .value.yellow { color: var(--yellow); }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin-bottom: 18px; }
.panel h3 { font-size: 12px; margin-bottom: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; font-weight: 700; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 700; }
td { padding: 9px 10px; border-bottom: 1px solid var(--panel2); }
tr:hover td { background: #f8fafc; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.diario { background: #f3f4f6; color: #374151; }
.badge.invitado { background: #d1fae5; color: #065f46; }
.badge.personal { background: #dbeafe; color: #1e40af; }
.badge.mensual { background: #ede9fe; color: #5b21b6; }
.badge.restaurant { background: #ffedd5; color: #9a3412; }
.badge.membresia { background: #fef3c7; color: #92400e; }
.badge.open { background: #fee2e2; color: #991b1b; }
.badge.inside { background: #d1fae5; color: #065f46; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: #ffffff; border: 1px solid var(--border); color: var(--muted); padding: 7px 16px; border-radius: 999px; font-size: 13px; transition: all .12s; }
.tabs button:hover { border-color: var(--accent); color: var(--accent); }
.tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { width: auto; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 34px; width: 360px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.login-box h1 { font-size: 22px; margin-bottom: 6px; color: var(--text); }
.login-box p { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.login-box .field { margin-bottom: 14px; }
.error { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; }
.muted { color: var(--muted); font-size: 13px; }

.modal-bg { display: none; position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 50; align-items: center; justify-content: center; }
.modal-bg.show { display: flex; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 24px; width: 480px; max-width: 92vw; max-height: 88vh; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,.12); position: relative; }
.modal-x { position: absolute; top: 10px; right: 12px; background: none; border: none; font-size: 22px; line-height: 1; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.modal-x:hover { background: var(--panel2); color: var(--text); }
.modal h3 { margin-bottom: 16px; font-size: 16px; }
.modal .field { margin-bottom: 12px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; display: flex; align-items: center; overflow-x: auto; padding: 10px; }
  .sidebar h1 { padding: 0 12px 0 4px; white-space: nowrap; }
  .sidebar nav { display: flex; }
  .sidebar nav button { white-space: nowrap; }
  .sidebar .userbox { display: none; }
}
