:root {
  /* Palm Island palette – tropical professional */
  --bg-primary: #f5f2ec;
  --bg-secondary: #eae6dd;
  --bg-card: #ffffff;
  --bg-card-hover: #f9f7f3;
  --border: #d4cfc4;
  --border-light: #bfb9ab;
  --text-primary: #1a2e1a;
  --text-secondary: #4a5e4a;
  --text-muted: #7d8c7d;
  --accent: #b8960c;
  --accent-hover: #d4ad0e;
  --accent-dim: rgba(184,150,12,0.10);
  --green: #4a6b2a;
  --green-dim: rgba(74,107,42,0.10);
  --red: #c0392b;
  --red-dim: rgba(192,57,43,0.10);
  --blue: #2e6b5a;
  --blue-dim: rgba(46,107,90,0.10);
  --purple: #5b7a3a;
  --purple-dim: rgba(91,122,58,0.10);
  --cyan: #1a6b5a;
  --cyan-dim: rgba(26,107,90,0.10);
  --sidebar-w: 240px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

a {
  text-decoration: none;
  color: inherit;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

body.logged-in {
  display: flex;
}

/* ============================================
   LOGIN
   ============================================ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-screen::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(245,158,11,0.08) 0%, transparent 70%);
  top: -100px;
  right: -100px;
}

.login-screen::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(59,130,246,0.06) 0%, transparent 70%);
  bottom: -150px;
  left: -100px;
}

.login-container {
  width: 420px;
  position: relative;
  z-index: 1;
}

.login-brand {
  text-align: center;
  margin-bottom: 40px;
}

.login-brand .logo-icon {
  width: 64px;
  height: 64px;
  background: var(--accent);
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 16px;
  box-shadow: 0 8px 32px rgba(184,150,12,0.25);
}

.login-brand h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 4px;
}

.login-brand p {
  font-size: 13px;
  color: var(--text-muted);
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}

.login-card h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.login-card .subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.login-field {
  margin-bottom: 20px;
}

.login-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.login-field input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  transition: border-color 0.2s;
}

.login-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-field input::placeholder {
  color: var(--text-muted);
}

.login-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  font-size: 13px;
}

.login-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  cursor: pointer;
}

.login-options input[type="checkbox"] {
  accent-color: var(--accent);
}

.login-options a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.login-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(184,150,12,0.3);
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
}

.role-hint {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.role-hint-title {
  font-size: 11px;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.role-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  transition: color 0.2s;
}

.role-opt:hover {
  color: var(--accent);
}

.role-opt .rdot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.role-opt .rtag {
  margin-left: auto;
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  color: var(--text-muted);
}

.app-wrapper {
  display: none;
  width: 100%;
}

.app-wrapper.show {
  display: flex;
}

.nav-item.nav-hidden {
  display: none;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: #1a3328;
  border-right: 1px solid #264a39;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid #264a39;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.sidebar-logo h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #e8f0eb;
}

.sidebar-logo span {
  font-size: 10px;
  color: #7fa893;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: block;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section {
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #5a8a6e;
  padding: 16px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  color: #9cbdaa;
  font-weight: 500;
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #d0e4d8;
}

.nav-item.active {
  background: rgba(184,150,12,0.18);
  color: #d4ad0e;
}

.nav-item .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #264a39;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #8a7a10);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #d0e4d8;
}

.user-role {
  font-size: 11px;
  color: #7fa893;
}

/* ============================================
   MAIN
   ============================================ */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  min-width: 0;
  overflow-x: hidden;
}

.topbar {
  height: 64px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
}

.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'Space Mono', monospace;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
}

.topbar-btn:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}

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

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

.search-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 260px;
}

.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  width: 100%;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

/* ============================================
   PAGE CONTENT
   ============================================ */
.page {
  display: none;
  padding: 28px;
}

.page.active {
  display: block;
}

/* ============================================
   DASHBOARD
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}

.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-card:nth-child(1)::before { background: var(--accent); }
.stat-card:nth-child(2)::before { background: var(--green); }
.stat-card:nth-child(3)::before { background: var(--blue); }
.stat-card:nth-child(4)::before { background: var(--red); }

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 4px;
}

.stat-change {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }

.stat-icon {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 40px;
  opacity: 0.08;
}

/* ============================================
   TABLE
   ============================================ */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}

.content-grid.full {
  grid-template-columns: 1fr;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-body {
  padding: 0;
}

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

th {
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #f0ece3;
  position: sticky;
  top: 0;
  white-space: nowrap;
}

td {
  padding: 10px 16px;
  font-size: 13px;
  border-bottom: 1px solid rgba(42,53,80,0.05);
  white-space: nowrap;
}

tr:hover td {
  background: rgba(0,0,0,0.02);
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.tag-private { background: var(--purple-dim); color: var(--purple); }
.tag-shared { background: var(--blue-dim); color: var(--blue); }
.tag-completed { background: var(--green-dim); color: var(--green); }
.tag-pending { background: var(--accent-dim); color: var(--accent); }
.tag-cancelled { background: var(--red-dim); color: var(--red); }
.tag-noshow { background: rgba(230, 126, 34, 0.12); color: #e67e22; font-weight: 600; }
.tag-arrival { background: var(--cyan-dim); color: var(--cyan); }
.tag-departure { background: var(--accent-dim); color: var(--accent); }

/* ============================================
   TOPBAR CLOCK
   ============================================ */
.topbar-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 14px;
  background: #1a3328;
  border-radius: 8px;
  min-width: 100px;
  border: 1px solid #264a39;
}

.clock-time {
  font-family: 'Space Mono', monospace;
  font-size: 15px;
  font-weight: 700;
  color: #d4ad0e;
  letter-spacing: 1px;
}

.clock-zone {
  font-size: 9px;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #7fa893;
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 560px;
  max-width: calc(100vw - 40px);
  max-height: 88vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  transition: border-color 0.2s;
}

.form-group textarea {
  resize: vertical;
  min-height: 64px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

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

/* ============================================
   BUTTONS
   ============================================ */

/* Reset browser button defaults */
button {
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
}

/* form-control alias for input/select */
.form-control {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Filter pills (Activos / Todos / Inactivos) */
.filter-group {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1400;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(184, 150, 12, 0.35);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}

.btn-danger:hover {
  background: var(--red-dim);
}

.btn-success {
  background: transparent;
  color: var(--green);
  border-color: var(--green);
}

.btn-success:hover {
  background: var(--green-dim);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.18s;
  padding: 0;
}

.btn-icon:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.btn-icon.btn-danger {
  border-color: transparent;
  background: transparent;
  color: var(--red);
}

.btn-icon.btn-danger:hover {
  background: var(--red-dim);
  border-color: var(--red);
}

.btn-icon.btn-success {
  border-color: var(--green);
  color: var(--green);
}

.btn-icon.btn-success:hover {
  background: var(--green-dim);
}

.action-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Content header action buttons */
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.content-header h1 {
  margin: 0 0 2px;
  font-size: 22px;
}

.content-header .content-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* Form footer */
.form-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 8px;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid transparent;
}

.alert-success {
  background: var(--green-dim);
  color: var(--green);
  border-color: var(--green);
}

.alert-error {
  background: var(--red-dim);
  color: var(--red);
  border-color: var(--red);
}

/* ============================================
   TABS
   ============================================ */
.tabs {
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--bg-primary);
  border-radius: 10px;
  margin-bottom: 20px;
  width: fit-content;
}

.tab {
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}

.tab:hover {
  color: var(--text-secondary);
}

.tab.active {
  background: var(--bg-card);
  color: var(--accent);
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #c4bfb4;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a9a498;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page.active > * {
  animation: fadeIn 0.4s ease both;
}

.page.active > *:nth-child(2) {
  animation-delay: 0.05s;
}

.page.active > *:nth-child(3) {
  animation-delay: 0.1s;
}

.page.active > *:nth-child(4) {
  animation-delay: 0.15s;
}

/* ============================================
   NOTIFICATION DOT
   ============================================ */
.notif-dot {
  position: relative;
}

.notif-dot::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

/* ============================================
   TABLE SCROLL
   ============================================ */
.table-scroll {
  overflow-x: auto;
}

/* ============================================
   PERIOD SELECTOR
   ============================================ */
.period-selector {
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--bg-primary);
  border-radius: 10px;
  margin-bottom: 20px;
  width: fit-content;
}

.period-btn {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  border: none;
  background: none;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}

.period-btn:hover {
  color: var(--text-secondary);
}

.period-btn.active {
  background: var(--bg-card);
  color: var(--accent);
}
