/* MachiOn Control Center — futuristic dark UI in MachiOn navy + orange */
:root {
  --bg: #040b18;
  --bg-2: #071328;
  --panel: rgba(13, 32, 64, .55);
  --panel-solid: #0b1a33;
  --panel-2: rgba(255, 255, 255, .035);
  --line: rgba(120, 170, 255, .14);
  --line-strong: rgba(120, 170, 255, .28);
  --text: #e8eefb;
  --muted: #8ea0bf;
  --dim: #5c6f8f;
  --orange: #f26a1b;
  --orange-2: #ff9a5c;
  --blue: #3d8bff;
  --cyan: #38d6ff;
  --green: #2fd28a;
  --red: #ff4d6d;
  --yellow: #ffc145;
  --radius: 14px;
  --radius-sm: 9px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --head: 'Archivo', system-ui, sans-serif;
  --body: 'Figtree', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --side-w: 262px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--body); background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--head); margin: 0; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--orange); color: #fff; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(120,170,255,.18); border-radius: 10px; border: 2px solid var(--bg); }

/* Ambient background */
.bg-grid { position: fixed; inset: 0; z-index: -2; background-image: linear-gradient(rgba(61,139,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(61,139,255,.06) 1px, transparent 1px); background-size: 46px 46px; mask-image: radial-gradient(ellipse at 60% 0%, #000 0%, transparent 75%); animation: gridmove 40s linear infinite; }
@keyframes gridmove { to { background-position: 46px 46px; } }
.bg-orbs span { position: fixed; z-index: -1; border-radius: 50%; filter: blur(90px); opacity: .35; pointer-events: none; }
.bg-orbs span:nth-child(1) { width: 520px; height: 520px; background: #1d4ed8; top: -180px; right: -120px; animation: float 18s ease-in-out infinite; }
.bg-orbs span:nth-child(2) { width: 380px; height: 380px; background: var(--orange); bottom: -200px; left: 20%; opacity: .16; animation: float 22s ease-in-out infinite reverse; }
@keyframes float { 50% { transform: translate(-40px, 40px); } }

/* Layout */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: linear-gradient(180deg, rgba(8,22,46,.92), rgba(4,11,24,.96)); border-right: 1px solid var(--line); backdrop-filter: blur(18px); z-index: 30; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; border-bottom: 1px solid var(--line); }
.side-brand { flex-direction: column; align-items: flex-start; gap: 8px; }
.brand-mark { position: relative; width: 190px; aspect-ratio: 1656 / 283; flex-shrink: 0; }
.brand-mark img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.m-machi { animation: machiIn .9s var(--ease) both; }
.m-on { animation: onPower .8s ease .6s both; }
.m-by { animation: byIn .6s var(--ease) 1s both; }
.side-brand:hover .m-on { animation: onPulse 1s var(--ease); }
@keyframes machiIn { from { clip-path: inset(0 100% 0 0); transform: translateX(-10px); } to { clip-path: inset(0 0 0 0); } }
@keyframes onPower { 0% { opacity: 0; } 20% { opacity: 1; } 35% { opacity: .25; } 55% { opacity: 1; } 70% { opacity: .5; } 100% { opacity: 1; } }
@keyframes byIn { from { opacity: 0; transform: translateY(6px); } }
@keyframes onPulse { 40% { filter: drop-shadow(0 0 10px rgba(242,106,27,.9)); } }
.brand-text strong { display: block; font-family: var(--head); font-size: 21px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.brand-text strong em { font-style: normal; color: var(--orange); text-shadow: 0 0 18px rgba(242,106,27,.6); }
.brand-text small { color: var(--muted); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; }
.side-nav { flex: 1; overflow-y: auto; padding: 10px 12px 20px; }
.side-group { margin: 18px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.side-link { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 2px 0; border-radius: 10px; color: var(--muted); font-weight: 600; transition: background .25s, color .25s, transform .3s var(--ease); }
.side-link i { width: 20px; text-align: center; font-size: 15px; }
.side-link:hover { color: var(--text); background: rgba(255,255,255,.04); transform: translateX(3px); }
.side-link.active { color: #fff; background: linear-gradient(90deg, rgba(242,106,27,.22), rgba(242,106,27,.02)); box-shadow: inset 0 0 0 1px rgba(242,106,27,.28); }
.side-link.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--orange); box-shadow: 0 0 14px var(--orange); }
.side-link.active i { color: var(--orange); }
.side-count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--orange); color: #fff; font-size: 11px; display: grid; place-items: center; box-shadow: 0 0 12px rgba(242,106,27,.6); }
.side-foot { padding: 16px 20px; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 12px; color: var(--dim); }
.side-foot a { color: var(--muted); }
.side-foot a:hover { color: var(--orange-2); }
.sys-pill { display: inline-flex; align-items: center; gap: 8px; color: var(--green); font-weight: 600; font-size: 12.5px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(47,210,138,.7); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(47,210,138,0); } 100% { box-shadow: 0 0 0 0 rgba(47,210,138,0); } }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: rgba(4,11,24,.72); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.cmd-trigger { display: flex; align-items: center; gap: 10px; width: min(420px, 50vw); padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); cursor: pointer; transition: border-color .25s; }
.cmd-trigger:hover { border-color: var(--line-strong); }
.cmd-trigger span { flex: 1; text-align: left; }
kbd { font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--muted); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.clock { font-family: var(--mono); color: var(--cyan); font-size: 13px; padding: 6px 10px; border-radius: 8px; background: rgba(56,214,255,.07); border: 1px solid rgba(56,214,255,.18); letter-spacing: .05em; }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 10px; border: 1px solid transparent; background: transparent; display: grid; place-items: center; color: var(--muted); cursor: pointer; transition: .25s; }
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,.05); border-color: var(--line); }
.bell b { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--orange); color: #fff; font-size: 10px; display: grid; place-items: center; padding: 0 4px; }
#sideToggle { display: none; }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 5px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, var(--orange), #ff9a5c); color: #fff; font-weight: 800; font-family: var(--head); }
.user-meta { text-align: left; line-height: 1.15; }
.user-meta strong { display: block; color: var(--text); font-size: 13px; }
.user-meta small { font-size: 11.5px; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px; padding: 6px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--line-strong); box-shadow: 0 24px 50px -20px #000; display: none; }
[data-dropdown].open .dropdown { display: block; animation: pop .2s var(--ease); }
.dropdown a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; color: var(--muted); }
.dropdown a:hover { background: rgba(255,255,255,.05); color: var(--text); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } }

.content { padding: 28px; display: grid; gap: 22px; align-content: start; animation: rise .5s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* Page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; }
.page-head p { color: var(--muted); margin: 4px 0 0; }
.crumb { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .14em; font-weight: 700; margin-bottom: 6px; }
.crumb a:hover { color: var(--orange-2); }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Panels */
.panel { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(14px); overflow: hidden; }
.panel::before { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: linear-gradient(135deg, rgba(61,139,255,.35), transparent 35%, transparent 65%, rgba(242,106,27,.3)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 15.5px; display: flex; align-items: center; gap: 10px; }
.panel-head h3 i { color: var(--orange); }
.panel-body { padding: 20px; }
.panel-body.flush { padding: 0; }
.grid { display: grid; gap: 22px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; }

/* KPI cards */
.kpi { position: relative; padding: 20px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); overflow: hidden; transition: transform .4s var(--ease), border-color .3s; }
.kpi:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.kpi::after { content: ''; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, var(--kc, var(--blue)) 0%, transparent 70%); opacity: .22; }
.kpi .k-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; color: var(--kc, var(--blue)); background: color-mix(in srgb, var(--kc, var(--blue)) 14%, transparent); box-shadow: 0 0 22px -4px var(--kc, var(--blue)); }
.kpi .k-label { color: var(--muted); font-size: 13px; margin-top: 16px; }
.kpi .k-val { font-family: var(--head); font-size: 32px; font-weight: 800; line-height: 1.1; margin-top: 2px; }
.kpi .k-sub { font-size: 12.5px; color: var(--dim); margin-top: 4px; }
.kpi .k-sub b { color: var(--green); }
.kpi.orange { --kc: var(--orange); } .kpi.cyan { --kc: var(--cyan); } .kpi.green { --kc: var(--green); } .kpi.blue { --kc: var(--blue); }
.kpi canvas { position: absolute; right: 14px; bottom: 14px; width: 110px !important; height: 40px !important; opacity: .9; }

/* Hero strip on dashboard */
.welcome { display: flex; align-items: center; gap: 24px; padding: 26px 28px; border-radius: 18px; background: linear-gradient(120deg, rgba(29,78,216,.32), rgba(8,22,46,.7) 55%, rgba(242,106,27,.22)); border: 1px solid var(--line-strong); position: relative; overflow: hidden; }
.welcome::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.06) 50%, transparent 70%); transform: translateX(-100%); animation: sheen 6s ease-in-out infinite; }
@keyframes sheen { 40%, 100% { transform: translateX(100%); } }
.welcome h1 { font-size: 26px; }
.welcome h1 span { color: var(--orange); }
.welcome p { color: var(--muted); margin: 6px 0 0; }
.welcome .w-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.radar { width: 74px; height: 74px; border-radius: 50%; border: 1px solid rgba(56,214,255,.4); position: relative; flex-shrink: 0; background: radial-gradient(circle, rgba(56,214,255,.15), transparent 70%); }
.radar::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, rgba(56,214,255,.5), transparent 25%); animation: spin 3s linear infinite; }
.radar::after { content: ''; position: absolute; inset: 18px; border-radius: 50%; border: 1px dashed rgba(56,214,255,.35); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 10px; border: 1px solid transparent; font-weight: 700; font-size: 14px; cursor: pointer; transition: transform .25s var(--ease), box-shadow .25s, background .25s, border-color .25s; white-space: nowrap; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: linear-gradient(135deg, var(--orange), #ff8a3d); color: #fff; box-shadow: 0 10px 24px -10px rgba(242,106,27,.8); }
.btn-primary:hover { box-shadow: 0 14px 30px -10px rgba(242,106,27,.95); }
.btn-ghost { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--line-strong); background: rgba(255,255,255,.07); }
.btn-danger { background: rgba(255,77,109,.12); border-color: rgba(255,77,109,.35); color: #ff8aa0; }
.btn-danger:hover { background: rgba(255,77,109,.22); }
.btn-green { background: rgba(37,211,102,.14); border-color: rgba(37,211,102,.4); color: #5ee598; }
.btn-sm { padding: 7px 11px; font-size: 13px; border-radius: 8px; }
.btn-icon { width: 34px; height: 34px; padding: 0; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: grid; gap: 7px; }
.field-label, label.field > span:first-child { font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.field-label em { color: var(--orange); font-style: normal; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=search], input[type=date], input[type=tel], select, textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: rgba(3,10,22,.6); color: var(--text); outline: none; transition: border-color .2s, box-shadow .2s;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(242,106,27,.18); }
select option { background: var(--panel-solid); }
.hint { color: var(--dim); font-size: 12px; }
.counter { font-family: var(--mono); font-size: 11.5px; color: var(--dim); justify-self: end; }
.counter.warn { color: var(--yellow); } .counter.bad { color: var(--red); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; color: var(--muted); font-weight: 600; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 20px; background: rgba(255,255,255,.1); border: 1px solid var(--line); position: relative; cursor: pointer; transition: .25s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .25s var(--ease); }
.switch input:checked { background: var(--orange); border-color: var(--orange); box-shadow: 0 0 14px rgba(242,106,27,.6); }
.switch input:checked::after { left: 20px; }
.form-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line); background: rgba(0,0,0,.15); }
.sticky-foot { position: sticky; bottom: 0; z-index: 5; backdrop-filter: blur(12px); }

.img-pick { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: start; }
.img-preview { aspect-ratio: 4/3; border-radius: 10px; border: 1px dashed var(--line-strong); display: grid; place-items: center; overflow: hidden; background: rgba(0,0,0,.25); color: var(--dim); font-size: 26px; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-actions { display: grid; gap: 8px; }
.row-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 13px 16px; border-bottom: 1px solid rgba(120,170,255,.07); vertical-align: middle; }
.tbl tr { transition: background .2s; }
.tbl tbody tr:hover { background: rgba(61,139,255,.05); }
.tbl tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
.tbl tr.unread .t-title { color: #fff; }
.t-title { font-weight: 700; color: var(--text); }
.t-sub { color: var(--dim); font-size: 12.5px; }
.t-actions { display: flex; gap: 6px; justify-content: flex-end; }
.thumb { width: 54px; height: 40px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); background: rgba(0,0,0,.3); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; border: 1px solid; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.badge-orange { color: var(--orange-2); border-color: rgba(242,106,27,.35); background: rgba(242,106,27,.1); }
.badge-blue { color: #7fb2ff; border-color: rgba(61,139,255,.35); background: rgba(61,139,255,.1); }
.badge-green { color: #5ee5a8; border-color: rgba(47,210,138,.35); background: rgba(47,210,138,.1); }
.badge-grey { color: var(--muted); border-color: var(--line); background: rgba(255,255,255,.03); }
.chip { display: inline-flex; padding: 3px 9px; border-radius: 6px; font-size: 12px; background: rgba(61,139,255,.1); color: #9cc3ff; border: 1px solid rgba(61,139,255,.2); font-family: var(--mono); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(0,0,0,.25); border: 1px solid var(--line); flex-wrap: wrap; }
.tabs a, .tabs button { padding: 8px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 13.5px; border: 0; background: none; cursor: pointer; }
.tabs a.on, .tabs button.on { background: linear-gradient(135deg, rgba(242,106,27,.28), rgba(242,106,27,.1)); color: #fff; box-shadow: inset 0 0 0 1px rgba(242,106,27,.35); }
.tabs a .n { margin-left: 6px; font-family: var(--mono); font-size: 11px; opacity: .8; }
.tab-pane { display: none; } .tab-pane.on { display: block; animation: rise .35s var(--ease); }
.pager { display: flex; gap: 6px; padding: 16px 20px; justify-content: flex-end; }
.pager a, .pager span { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); color: var(--muted); font-weight: 700; font-size: 13px; }
.pager a.on, .pager a:hover { border-color: var(--orange); color: #fff; background: rgba(242,106,27,.18); }

/* Detail lists */
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 0; }
.dl dt, .dl dd { padding: 11px 0; border-bottom: 1px solid rgba(120,170,255,.07); margin: 0; }
.dl dt { color: var(--dim); font-size: 13px; font-weight: 600; }
.dl dd { color: var(--text); word-break: break-word; }

/* Feed / timeline */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: start; padding: 12px 20px; border-bottom: 1px solid rgba(120,170,255,.07); }
.feed .f-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(61,139,255,.12); color: #7fb2ff; font-size: 13px; }
.feed .f-ico.create { background: rgba(47,210,138,.12); color: var(--green); }
.feed .f-ico.delete { background: rgba(255,77,109,.12); color: var(--red); }
.feed .f-ico.login { background: rgba(56,214,255,.12); color: var(--cyan); }
.feed .f-ico.update { background: rgba(242,106,27,.12); color: var(--orange-2); }
.feed small { color: var(--dim); font-size: 12px; white-space: nowrap; }
.feed p { margin: 0; }
.feed .f-who { color: var(--muted); font-size: 12.5px; }

/* Chat transcript */
.transcript { display: grid; gap: 12px; padding: 20px; max-height: 70vh; overflow-y: auto; }
.bubble { max-width: 76%; padding: 11px 14px; border-radius: 14px; line-height: 1.5; white-space: pre-wrap; }
.bubble.user { justify-self: end; background: linear-gradient(135deg, var(--orange), #ff8a3d); color: #fff; border-bottom-right-radius: 4px; }
.bubble.assistant { background: rgba(61,139,255,.1); border: 1px solid rgba(61,139,255,.22); border-bottom-left-radius: 4px; }
.bubble small { display: block; margin-top: 6px; opacity: .7; font-size: 11px; font-family: var(--mono); }

/* Media grid */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; padding: 20px; }
.m-item { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: rgba(0,0,0,.25); transition: transform .3s var(--ease), border-color .3s, box-shadow .3s; cursor: pointer; }
.m-item:hover { transform: translateY(-3px); border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange), 0 16px 30px -18px var(--orange); }
.m-item .m-img { aspect-ratio: 4/3; display: grid; place-items: center; overflow: hidden; background: repeating-conic-gradient(rgba(255,255,255,.04) 0 25%, transparent 0 50%) 0 0/16px 16px; }
.m-item img { width: 100%; height: 100%; object-fit: cover; }
.m-item .m-meta { padding: 8px 10px; font-size: 12px; }
.m-item .m-meta strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.m-item .m-meta span { color: var(--dim); font-family: var(--mono); font-size: 11px; }
.m-item .m-tag { position: absolute; top: 8px; left: 8px; font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: rgba(4,11,24,.8); color: var(--cyan); border: 1px solid rgba(56,214,255,.3); }
.m-item.selected { border-color: var(--orange); box-shadow: 0 0 0 2px var(--orange); }
.dropzone { margin: 20px 20px 0; padding: 28px; border: 1.5px dashed var(--line-strong); border-radius: 14px; text-align: center; color: var(--muted); transition: .25s; background: rgba(61,139,255,.04); }
.dropzone.drag { border-color: var(--orange); background: rgba(242,106,27,.08); color: var(--text); }
.dropzone i { font-size: 28px; color: var(--orange); margin-bottom: 8px; display: block; }

/* SERP preview */
.serp { padding: 16px 18px; border-radius: 12px; background: #fff; color: #202124; font-family: arial, sans-serif; }
.serp .s-url { font-size: 12.5px; color: #4d5156; }
.serp .s-title { font-size: 19px; color: #1a0dab; margin: 4px 0; line-height: 1.3; }
.serp .s-desc { font-size: 13.5px; color: #4d5156; line-height: 1.5; }

/* Permission matrix */
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.perm-table input { width: 18px; height: 18px; accent-color: var(--orange); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(2,6,14,.72); backdrop-filter: blur(6px); }
.modal[hidden] { display: none; }
.modal-card { width: min(560px, 100%); max-height: 88vh; overflow: auto; border-radius: 16px; background: var(--panel-solid); border: 1px solid var(--line-strong); box-shadow: 0 40px 80px -30px #000; animation: pop .25s var(--ease); }
.modal-card.wide { width: min(1100px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel-solid); z-index: 2; }
.modal-head h3 { margin-right: auto; display: flex; gap: 10px; align-items: center; }
.modal-head h3 i { color: var(--orange); }
.modal-head input[type=search] { max-width: 260px; }
.modal.cmd { place-items: start center; padding-top: 12vh; }
.cmd-card { width: min(620px, 100%); }
.cmd-input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); color: var(--muted); }
.cmd-input input { flex: 1; border: 0; background: transparent; outline: none; font-size: 16px; color: var(--text); padding: 4px 0; box-shadow: none; }
.cmd-list { padding: 8px; max-height: 50vh; overflow: auto; }
.cmd-list a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: var(--muted); }
.cmd-list a i { width: 20px; color: var(--orange); }
.cmd-list a.on, .cmd-list a:hover { background: rgba(242,106,27,.14); color: #fff; }

/* Toasts */
.toast { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 12px; border: 1px solid; font-weight: 600; animation: rise .4s var(--ease); }
.toast-success { color: #7cf0bd; background: rgba(47,210,138,.1); border-color: rgba(47,210,138,.35); }
.toast-error { color: #ff9fb1; background: rgba(255,77,109,.1); border-color: rgba(255,77,109,.35); }
.toast-x { margin-left: auto; background: none; border: 0; color: inherit; font-size: 20px; cursor: pointer; opacity: .7; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state i { font-size: 34px; color: var(--orange); margin-bottom: 12px; display: block; }
.empty-state.big { padding: 90px 20px; }
.empty-state h2 { color: var(--text); margin-bottom: 8px; }
.empty-state .btn { margin-top: 18px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.text-orange { color: var(--orange-2); }
.stack { display: grid; gap: 22px; }
.inline-form { display: inline; }
.bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.07); overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); border-radius: inherit; }
.list-rows { display: grid; gap: 14px; padding: 18px 20px; }
.list-rows .lr-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }

/* Login */
body.login { display: grid; place-items: center; padding: 20px; }
.login-card { width: min(430px, 100%); padding: 34px; border-radius: 22px; background: rgba(8,22,46,.75); border: 1px solid var(--line-strong); backdrop-filter: blur(18px); box-shadow: 0 50px 100px -40px #000, 0 0 60px -30px var(--blue); position: relative; overflow: hidden; }
.login-card::before { content: ''; position: absolute; top: 0; left: -40%; width: 40%; height: 2px; background: linear-gradient(90deg, transparent, var(--orange), transparent); animation: scan 3.5s linear infinite; }
@keyframes scan { to { left: 100%; } }
.login-logo { display: grid; justify-items: center; gap: 12px; margin-bottom: 26px; text-align: center; }
.login-logo .brand-mark { width: 280px; }
.login-logo h1 { font-size: 30px; }
.login-logo h1 em { font-style: normal; color: var(--orange); text-shadow: 0 0 20px rgba(242,106,27,.6); }
.login-logo p { color: var(--muted); margin: 0; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.login-card form { display: grid; gap: 16px; }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--dim); }
.input-icon input { padding-left: 40px; }

/* Responsive */
@media (max-width: 1200px) { .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--side-w); transform: translateX(-100%); transition: transform .35s var(--ease); }
  body.side-open .sidebar { transform: none; box-shadow: 30px 0 60px rgba(0,0,0,.6); }
  #sideToggle { display: grid; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .user-meta, .clock { display: none; }
  .content { padding: 18px; }
  .topbar { padding: 12px 16px; }
  .welcome { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .g-4, .form-grid { grid-template-columns: 1fr; }
  .cmd-trigger span, .cmd-trigger kbd { display: none; }
  .cmd-trigger { width: auto; }
  .img-pick { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { border: 0; padding-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.side-link.on { color: #fff; background: linear-gradient(90deg, rgba(242,106,27,.22), rgba(242,106,27,.02)); box-shadow: inset 0 0 0 1px rgba(242,106,27,.28); }
.side-link.on i { color: var(--orange); }
