:root {
  --primary: #e85d04;
  --secondary: #1c4f82;
  --bg: #f4f6f9;
  --card: #fff;
  --text: #1f2733;
  --muted: #647488;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(20,30,50,.08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
img { max-width: 100%; }
button { font-family: inherit; }

.btn { display: inline-block; padding: 10px 20px; border-radius: 8px; border: none; font-weight: 600; cursor: pointer; font-size: 14px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #c44d00; }
.btn-outline { background: #fff; border: 1px solid #d9e1ea; color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-danger { background: #d33; color: #fff; }

/* Login */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f2236, #1c4f82); }
.login-card { background: #fff; padding: 40px; border-radius: var(--radius); width: 340px; text-align: center; box-shadow: var(--shadow); }
.login-logo { width: 56px; margin: 0 auto 10px; }
.login-card h1 { font-size: 20px; margin: 6px 0 0; color: var(--secondary); }
.login-card p { color: var(--muted); margin: 4px 0 20px; font-size: 13px; }
.login-card label { display: block; text-align: left; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.login-card input { width: 100%; padding: 10px 12px; margin-bottom: 16px; border-radius: 8px; border: 1px solid #d9e1ea; }
.login-error { color: #d33; font-size: 13px; margin-top: 10px; }

/* Dashboard layout */
.dashboard { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; background: #0f2236; color: #cfd9e6; padding: 24px 18px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff; margin-bottom: 30px; font-size: 16px; }
.sidebar-brand img { width: 32px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nav-item {
  background: none; border: none; color: #cfd9e6; text-align: left; padding: 12px 14px; border-radius: 8px;
  font-size: 14px; cursor: pointer; display: block;
}
.nav-item:hover { background: rgba(255,255,255,.08); }
.nav-item.active { background: var(--primary); color: #fff; }

.main { flex: 1; padding: 30px 36px; }
.main-header { margin-bottom: 24px; }
.main-header h1 { color: var(--secondary); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 18px; margin-bottom: 36px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .label { color: var(--muted); font-size: 13px; margin-top: 4px; }

.view-actions { margin-bottom: 16px; display: flex; justify-content: flex-end; gap: 10px; }
.view-actions select { padding: 8px 12px; border-radius: 8px; border: 1px solid #d9e1ea; }

.table-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid #eef1f5; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; background: #fafbfd; }
tr:last-child td { border-bottom: none; }
img.thumb { width: 60px; height: 38px; object-fit: cover; border-radius: 6px; background: #eef3f8; }

.status-pill { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.status-pending { background: #fff3e0; color: #b36b00; }
.status-confirmed { background: #e3f7ec; color: #137a43; }
.status-completed { background: #e7f0fe; color: #1c4f82; }
.status-cancelled { background: #fdeeee; color: #b33; }

select.status-select { padding: 5px 8px; border-radius: 6px; border: 1px solid #d9e1ea; font-size: 12px; }

/* Modal reused */
.modal-overlay { position: fixed; inset: 0; background: rgba(10,18,30,.6); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 200; }
.modal { background: #fff; border-radius: var(--radius); max-width: 600px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative; padding: 30px; }
.modal-close { position: absolute; top: 14px; right: 16px; background: none; border: none; font-size: 26px; cursor: pointer; color: var(--muted); }
.modal h2 { color: var(--secondary); margin-top: 0; }

.admin-form label { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin: 12px 0 5px; }
.admin-form input, .admin-form select, .admin-form textarea {
  width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid #d9e1ea; font-size: 14px;
}
.admin-form textarea { min-height: 60px; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 14px; }
.content-group { border: 1px solid #d9e1ea; border-radius: var(--radius); padding: 10px 18px 18px; margin-bottom: 18px; }
.content-group legend { font-weight: 700; color: var(--secondary); padding: 0 6px; }
.editor-frame-wrap { border: 1px solid #d9e1ea; border-radius: var(--radius); overflow: hidden; height: calc(100vh - 220px); }
#editor-frame { width: 100%; height: 100%; border: none; }
.image-preview { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 10px; }
.image-preview img { width: 160px; height: 100px; object-fit: cover; border-radius: 8px; }
.image-preview-item { position: relative; }
.image-preview-item .remove-image-btn {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%;
  background: #d33; color: #fff; border: none; cursor: pointer; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center; padding: 0;
}

.toast { position: fixed; bottom: 24px; right: 24px; background: #1c4f82; color: #fff; padding: 14px 22px; border-radius: 10px; box-shadow: var(--shadow); z-index: 300; transition: opacity .3s, transform .3s; }
.toast.error { background: #c0392b; }
.toast.hidden { opacity: 0; transform: translateY(20px); pointer-events: none; }

@media (max-width: 800px) {
  .dashboard { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .main { padding: 20px; }
}
