:root{
  --bg0:#0b0f16;
  --bg1:#0f1623;

  --card:rgba(18,25,40,.78);
  --stroke:rgba(255,255,255,.08);
  --stroke2:rgba(255,255,255,.12);

  --text:#e9edf5;
  --muted:rgba(233,237,245,.68);

  --brand:#ff6a00;
  --danger:#ff4d4d;

  --shadow: 0 14px 40px rgba(0,0,0,.45);
  --shadow2: 0 10px 30px rgba(0,0,0,.35);
  --radius: 18px;
  --radius2: 22px;

  --focus: 0 0 0 3px rgba(255,106,0,.35);
  color-scheme: dark;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1100px 600px at 15% 10%, rgba(255,106,0,.14), transparent 60%),
    radial-gradient(900px 600px at 80% 15%, rgba(255,255,255,.06), transparent 55%),
    linear-gradient(135deg, var(--bg0), var(--bg1));
  color: var(--text);
}

.hidden{ display:none !important; }
.muted{ color: var(--muted); }
.tiny{ font-size:.85rem; }

.app-shell{ min-height:100vh; }

.topbar{
  position: sticky;
  top: 0;
  z-index: 5;
  display:flex;
  justify-content:space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--stroke);
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(10px);
}
.topbar .left{ display:flex; align-items:center; gap: 12px; }
.topbar .right{ display:flex; align-items:center; gap: 10px; flex-wrap:wrap; justify-content:flex-end; }

.logo-badge{
  width:44px;height:44px;border-radius:14px;
  display:grid;place-items:center;
  background: rgba(255,106,0,.12);
  border: 1px solid rgba(255,106,0,.22);
  color: var(--brand);
}

h1{ margin:0; font-size: 1.1rem; }
h2{ margin:0; font-size: 1.05rem; }
p{ margin:6px 0 0; }

.pill{
  display:inline-flex;
  align-items:center;
  padding: 7px 10px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  font-weight: 800;
}

.main{ padding: 16px; }

.grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.full{ grid-column: 1 / -1; }

.card{
  border:1px solid var(--stroke);
  border-radius: var(--radius2);
  background: var(--card);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow2);
  overflow:hidden;
}
.card-head{
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--stroke);
}
.card-head.split{
  display:flex;
  justify-content:space-between;
  gap: 10px;
  flex-wrap:wrap;
}
.card-body{ padding: 14px; }

.btn{
  display:inline-flex;
  align-items:center;
  gap:10px;
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid transparent;
  cursor:pointer;
  font-weight: 900;
  letter-spacing:.2px;
  transition: transform .15s ease, background .15s ease, opacity .15s ease;
  user-select:none;
  text-decoration:none;
}
.btn:disabled{ opacity:.5; cursor:not-allowed; }
.btn:hover{ transform: translateY(-1px); }
.btn-primary{
  background: linear-gradient(180deg, var(--brand), #ff4f00);
  color: #0b0f16;
  box-shadow: 0 10px 18px rgba(255,106,0,.22);
}
.btn-ghost{
  background: rgba(255,255,255,.06);
  border-color: var(--stroke);
  color: rgba(233,237,245,.92);
}
.btn-ghost.danger{
  background: rgba(255,77,77,.12);
  border-color: rgba(255,77,77,.22);
}

input, select, textarea{
  width:100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--stroke2);
  background: rgba(0,0,0,.25);
  color: var(--text);
  outline:none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea{ resize: vertical; }
input:focus, select:focus, textarea:focus{
  border-color: rgba(255,106,0,.55);
  box-shadow: var(--focus);
}
.field{ display:flex; flex-direction:column; gap:8px; }
.field > span{ font-weight: 800; font-size:.92rem; color: rgba(233,237,245,.9); }

.form-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-grid .full{ grid-column: 1 / -1; }

.row.full{ grid-column: 1 / -1; }
.actions{ display:flex; gap:10px; flex-wrap:wrap; }

.field.switch .switch-row{ display:flex; align-items:center; gap:10px; }
.field.switch input[type="checkbox"]{
  width: 18px; height: 18px;
  accent-color: var(--brand);
}

.preview{
  position:relative;
  width:100%;
  height: 320px;
  border-radius: 18px;
  overflow:hidden;
  border:1px solid var(--stroke);
  background: rgba(0,0,0,.25);
}
.preview-bg{
  position:absolute; inset:0;
  background-size: cover;
  background-position: center;
  transform: scale(1.05);
}
.preview-overlay{
  position:absolute; inset:0;
  background: linear-gradient(90deg, rgba(0,0,0,.78) 0%, rgba(0,0,0,.35) 55%, rgba(0,0,0,.10) 100%);
}
.preview-content{
  position:absolute; inset:0;
  padding: 18px;
  display:flex;
  flex-direction:column;
  gap: 10px;
  justify-content:flex-end;
}
.badges{ display:flex; gap:8px; flex-wrap:wrap; }
.badge{
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  font-weight: 900;
  font-size:.85rem;
}
.rating{
  display:flex; align-items:center; gap:8px; font-weight: 900;
}
.rating i{ color: #ffcc66; }

.input-icon{ position:relative; display:flex; align-items:center; }
.input-icon i{ position:absolute; left:12px; opacity:.7; }
.input-icon input{ padding-left: 38px; }

.table-wrap{ width:100%; overflow:auto; }
.table{
  width:100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
}
.table th, .table td{
  padding: 12px;
  border-bottom: 1px solid var(--stroke);
  white-space: nowrap;
}
.table thead th{
  position: sticky;
  top:0;
  z-index: 1;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(8px);
  font-size: .92rem;
  opacity: .95;
}
.th-actions{ text-align:right; width: 220px; }

.row-actions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  align-items:center;
}
.action-btn{
  width: 38px; height: 38px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  color: rgba(233,237,245,.92);
  cursor:pointer;
}
.action-btn:hover{ background: rgba(255,255,255,.10); }
.action-btn.danger{
  background: rgba(255,77,77,.12);
  border-color: rgba(255,77,77,.22);
}

.overlay{
  position: fixed; inset: 0;
  display:grid; place-items:center;
  background: rgba(0,0,0,.55);
  z-index: 999;
}
.spinner{
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 4px solid rgba(255,106,0,.40);
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

.toast{
  position: fixed;
  right: 18px; bottom: 18px;
  max-width: 520px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow2);
  z-index: 1000;
  transform: translateY(12px);
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show{ opacity: 1; transform: translateY(0); }
.toast.ok{ border-color: rgba(50,213,131,.25); }
.toast.bad{ border-color: rgba(255,77,77,.25); }
.toast.warn{ border-color: rgba(255,204,102,.25); }

@media (max-width: 1100px){
  .grid{ grid-template-columns: 1fr; }
  .form-grid{ grid-template-columns: 1fr; }
}
