/* SilTech admin panel styles */
:root {
  --navy: #0b1f3a; --navy-2: #13294b; --navy-3: #1d3a66;
  --gold: #c9a14a; --gold-2: #e0bd6e;
  --bg: #f4f2ed; --card: #fff; --ink: #1b2433; --muted: #667085; --line: #e5e1d8;
  --danger: #b42318; --ok: #137a43;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Inter", system-ui, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
h1, h3 { font-family: "Playfair Display", Georgia, serif; color: var(--navy); margin: 0; }
.muted { color: var(--muted); margin: 0; }

.btn { display: inline-flex; align-items: center; gap: .5em; padding: .65em 1.2em; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--navy); font: inherit; font-weight: 600; cursor: pointer; transition: background .2s, transform .15s; }
.btn:hover { background: #f8f6f1; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-sm { padding: .45em .9em; font-size: .85rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-2)); border-color: transparent; color: var(--navy); }
.btn-gold:hover { background: linear-gradient(135deg, var(--gold-2), var(--gold)); }
.btn-navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-3); }
.btn.danger, button.danger { color: var(--danger); }
.btn-add { width: 100%; justify-content: center; border-style: dashed; padding: 1em; color: var(--muted); }
.btn-add:hover { color: var(--navy); border-color: var(--gold); }

.brand-mark { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; background: linear-gradient(135deg, var(--navy), var(--navy-3)); color: var(--gold-2); font-family: "Playfair Display", serif; font-size: 1.3rem; font-weight: 700; box-shadow: inset 0 0 0 2px rgba(224, 189, 110, .4); }

/* Auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(900px 500px at 80% 10%, #1f4275, transparent 60%), linear-gradient(160deg, var(--navy), #081629); }
.auth-card { width: min(420px, 100%); background: #fff; border-radius: 18px; padding: 36px; box-shadow: 0 30px 70px rgba(0, 0, 0, .35); }
.auth-brand { display: flex; gap: .8rem; align-items: center; margin-bottom: 1.6rem; }
.auth-brand b { display: block; color: var(--navy); }
.auth-brand small { color: var(--muted); }
.auth-card h1 { font-size: 1.7rem; margin-bottom: .3rem; }
.auth-form { display: grid; gap: 1rem; margin-top: 1.4rem; }
.auth-form label { display: grid; gap: .35rem; font-weight: 600; font-size: .88rem; color: var(--navy); }
.back { display: inline-block; margin-top: 1.4rem; color: var(--muted); font-size: .88rem; }
.back:hover { color: var(--navy); }
.alert { padding: .8em 1em; border-radius: 10px; font-size: .9rem; margin-top: 1rem; }
.alert.err { background: #fdecec; color: var(--danger); }

input[type=text], input[type=password], input:not([type]), textarea, select { width: 100%; font: inherit; padding: .7em .9em; border: 1px solid var(--line); border-radius: 9px; background: #fcfbf8; color: var(--ink); transition: border-color .2s, box-shadow .2s; }
input:focus, textarea:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 161, 74, .15); background: #fff; }
textarea { resize: vertical; }

/* Layout */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: rgba(255, 255, 255, .75); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; gap: .8rem; align-items: center; padding: 22px 20px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.side-brand b { color: #fff; display: block; }
.side-brand small { font-size: .78rem; }
#sideNav { padding: 12px; display: grid; gap: 2px; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: rgba(255, 255, 255, .4); padding: 16px 12px 6px; }
#sideNav a { display: flex; align-items: center; gap: .8rem; padding: .62em .9em; border-radius: 9px; font-size: .92rem; transition: background .2s, color .2s; }
#sideNav a i { width: 18px; text-align: center; color: rgba(224, 189, 110, .7); }
#sideNav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
#sideNav a.active { background: rgba(224, 189, 110, .14); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
#sideNav a.active i { color: var(--gold-2); }
#sideNav em { margin-left: auto; font-style: normal; background: var(--gold); color: var(--navy); font-size: .72rem; font-weight: 700; border-radius: 999px; padding: .05em .6em; }
.side-foot { margin-top: auto; padding: 16px 20px 22px; display: grid; gap: .7rem; border-top: 1px solid rgba(255, 255, 255, .08); font-size: .9rem; }
.side-foot a:hover { color: var(--gold-2); }
.side-foot i { width: 18px; }

.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: 18px 32px; background: rgba(244, 242, 237, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 1.55rem; }
.topbar p { font-size: .9rem; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 1rem; flex: none; }
.dirty { color: #b26b00; font-size: .85rem; font-weight: 600; }
.dirty i { font-size: .5rem; vertical-align: middle; margin-right: .3em; }
.menu-btn { display: none; background: none; border: 0; font-size: 1.3rem; color: var(--navy); cursor: pointer; }
.view { padding: 28px 32px 60px; max-width: 1100px; display: grid; gap: 20px; }
.view > div { display: grid; gap: 20px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: grid; gap: 14px; }
.card h3 { font-size: 1.2rem; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.field { display: grid; gap: .35rem; align-content: start; }
.field.wide { grid-column: 1 / -1; }
.field > label { font-weight: 600; font-size: .85rem; color: var(--navy); }
.field .check { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.hint { color: var(--muted); font-size: .78rem; }
.icon-input, .url-input { display: flex; gap: 8px; align-items: center; }
.icon-preview { width: 42px; height: 42px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--navy); color: var(--gold-2); }
.url-test { width: 42px; height: 42px; flex: none; border-radius: 9px; display: grid; place-items: center; border: 1px solid var(--line); color: var(--muted); }
.url-test:hover { color: var(--navy); border-color: var(--gold); }

.img-field { display: flex; gap: 14px; align-items: center; }
.img-preview { width: 160px; height: 100px; flex: none; border-radius: 10px; overflow: hidden; background: var(--bg); border: 1px dashed var(--line); display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; display: none; }
.img-preview.has { border-style: solid; }
.img-preview.has img { display: block; }
.img-preview.has .img-empty { display: none; }
.img-controls { flex: 1; min-width: 0; display: grid; gap: 8px; }
.btn.busy { opacity: .6; pointer-events: none; }
.btn.busy i { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* List editor */
.list { display: grid; gap: 10px; }
.item { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.item.open { border-color: rgba(201, 161, 74, .6); box-shadow: 0 8px 24px rgba(11, 31, 58, .06); }
.item-head { display: flex; align-items: center; }
.item-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: .9rem; padding: 14px 18px; background: none; border: 0; font: inherit; font-weight: 600; color: var(--navy); cursor: pointer; text-align: left; }
.item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-icon, .item-num { width: 34px; height: 34px; flex: none; border-radius: 8px; display: grid; place-items: center; background: rgba(201, 161, 74, .14); color: var(--gold); font-size: .9rem; }
.caret { margin-left: auto; color: var(--muted); transition: transform .2s; }
.item.open .caret { transform: rotate(180deg); }
.item-tools { display: flex; gap: 2px; padding-right: 10px; }
.item-tools button { width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.item-tools button:hover:not(:disabled) { background: var(--bg); color: var(--navy); }
.item-tools button.danger:hover { color: var(--danger); }
.item-tools button:disabled { opacity: .3; cursor: default; }
.item-body { display: none; padding: 4px 18px 20px; border-top: 1px solid var(--line); padding-top: 18px; }
.item.open .item-body { display: block; }
.list.compact { grid-template-columns: 1fr 1fr; }
.list-wrap { display: grid; gap: 14px; }
.list-search { padding: .8em 1em; border-radius: 12px; background: #fff; }
.item[hidden] { display: none; }
.list.compact .btn-add { grid-column: 1 / -1; }

/* Dashboard */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.tile { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; cursor: pointer; font: inherit; display: grid; gap: 4px; transition: transform .2s, box-shadow .2s; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(11, 31, 58, .08); }
.tile i { color: var(--gold); font-size: 1.2rem; }
.tile b { font-family: "Playfair Display", serif; font-size: 2rem; color: var(--navy); }
.tile span { color: var(--muted); font-size: .88rem; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; word-break: break-all; }
.table td:first-child { word-break: normal; font-weight: 600; color: var(--navy); }
.link { color: var(--navy-3); text-decoration: underline; text-decoration-color: rgba(29, 58, 102, .3); }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; padding: .15em .7em; border-radius: 999px; background: #e8f0fe; color: var(--navy-3); margin-left: .5em; }
.pill.warn { background: #fff4e0; color: #9a5b00; margin: 0; }
.pill.gold { background: rgba(201, 161, 74, .16); color: #7d5f1b; margin: 0; }
.help { margin: 0; padding-left: 1.2em; color: var(--muted); display: grid; gap: .4rem; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; }

/* Orders */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: .85rem; font-weight: 600; padding: .45em .9em; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--navy); cursor: pointer; }
.chip em { font-style: normal; font-size: .75rem; color: var(--muted); margin-left: .2em; }
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip.active em { color: var(--gold-2); }
.order.unread { border-left: 3px solid var(--gold); }
.order-no { font-family: "Playfair Display", serif; font-size: 1.15rem; color: var(--navy); }
.order-cust { display: grid; gap: 4px; }
.order-cust b { color: var(--navy); }
.order-ship { display: flex; gap: 12px; align-items: flex-start; background: #fffaf0; border-left: 3px solid var(--gold); padding: 10px 14px; border-radius: 0 10px 10px 0; }
.order-ship i { color: var(--gold); margin-top: 3px; }
.order-ship b { color: var(--navy); display: block; }
.order-ship small { color: var(--muted); }
.order-lines td { word-break: normal; }
.order-lines td:first-child { font-weight: 500; }
.order-lines th:not(:first-child), .order-lines td:not(:first-child) { text-align: right; white-space: nowrap; }
.order-lines tfoot td { border: 0; padding-top: 6px; padding-bottom: 6px; text-align: right; color: var(--muted); }
.order-lines tfoot .grand td { color: var(--navy); font-weight: 700; font-size: 1rem; }
.status-select { width: auto; font-weight: 600; padding: .4em .8em; border-radius: 999px; }
.status-select.s-new { background: #fff4e0; color: #9a5b00; border-color: #f3d6a3; }
.status-select.s-confirmed, .status-select.s-invoiced { background: #e8f0fe; color: var(--navy-3); }
.status-select.s-paid, .status-select.s-delivered { background: #e8f6ee; color: var(--ok); }
.status-select.s-cancelled { background: #fdecec; color: var(--danger); }

/* Messages */
.msg.unread { border-left: 3px solid var(--gold); }
.msg-head { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.msg-head b { color: var(--navy); font-size: 1.02rem; }
.msg-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; font-size: .88rem; color: var(--navy-3); align-items: center; }
.msg-text { margin: 0; white-space: pre-wrap; background: var(--bg); padding: 14px; border-radius: 9px; }
.msg-actions { display: flex; gap: 8px; }
.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.empty i { font-size: 2.4rem; color: var(--gold); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 30px); background: var(--navy); color: #fff; padding: 12px 22px; border-radius: 10px; box-shadow: 0 14px 30px rgba(0, 0, 0, .25); opacity: 0; pointer-events: none; transition: .3s; z-index: 100; font-weight: 500; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--danger); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: 270px; z-index: 30; transform: translateX(-100%); transition: transform .3s; box-shadow: 10px 0 40px rgba(0, 0, 0, .3); }
  .side.open { transform: none; }
  .menu-btn { display: block; }
  .topbar { padding: 14px 16px; flex-wrap: wrap; }
  .topbar h1 { font-size: 1.25rem; }
  .topbar p { display: none; }
  .view { padding: 18px 16px 50px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .grid, .list.compact { grid-template-columns: 1fr; }
  .dirty { display: none; }
  .img-field { flex-direction: column; align-items: stretch; }
  .img-preview { width: 100%; height: 150px; }
}
@media (max-width: 520px) {
  .top-actions .btn { padding: .6em .9em; font-size: .85rem; }
  .table thead { display: none; }
  .table tr { display: grid; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .table td { border: 0; padding: 4px 6px; }
}
