/* DAEGES Cloud — application UI (auth, portal, admin) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap');

:root {
  --bg: #0a0d12;
  --bg-2: #0f141b;
  --panel: #131922;
  --panel-2: #18202b;
  --line: #222c39;
  --line-2: #2c3847;
  --text: #e8edf3;
  --text-2: #a7b2c0;
  --muted: #6f7c8c;
  --accent: #ff5a00;
  --accent-2: #ff8a3d;
  --accent-soft: rgba(255, 90, 0, .12);
  --good: #2fbf71;
  --good-soft: rgba(47, 191, 113, .12);
  --warn: #f2b33d;
  --warn-soft: rgba(242, 179, 61, .12);
  --bad: #f0524f;
  --bad-soft: rgba(240, 82, 79, .12);
  --info: #4aa3ff;
  --info-soft: rgba(74, 163, 255, .12);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: Inter, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.dim { color: var(--text-2); }
.mono { font-family: var(--mono); font-size: 12px; }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 14px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); } }
.grid > * { min-width: 0; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--text); font: 600 13.5px var(--font); cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; text-decoration: none !important;
}
.btn:hover { background: #1f2834; border-color: #3a4757; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #ff6d1f; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn.block { width: 100%; height: 44px; font-size: 14.5px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.icon-btn { width: 34px; height: 34px; padding: 0; }

label.field { display: block; }
label.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
label.field > small { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input[type=tel], select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: var(--bg-2); color: var(--text); font: 14px var(--font); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: #566273; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-wrap button { position: absolute; right: 4px; top: 4px; height: 32px; width: 36px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.pw-meter { height: 4px; border-radius: 2px; background: var(--line); margin-top: 8px; overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; background: var(--bad); transition: width .2s, background .2s; }

/* ---------- surfaces ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { flex: 1; }
.card-body { padding: 20px; }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--panel-2); color: var(--text-2); border: 1px solid var(--line-2); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent-2); border-color: transparent; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text-2); margin: 2px 4px 2px 0; }

table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: rgba(255, 255, 255, .02); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 36px; height: 36px; opacity: .5; display: block; margin: 0 auto 10px; }

.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: linear-gradient(135deg, #ff5a00, #b33a00); flex: none; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; border: 1px solid; }
.alert.bad { background: var(--bad-soft); border-color: rgba(240, 82, 79, .35); color: #ffb3b1; }
.alert.good { background: var(--good-soft); border-color: rgba(47, 191, 113, .35); color: #9fe6be; }
.alert.info { background: var(--info-soft); border-color: rgba(74, 163, 255, .35); color: #b6dbff; }
.alert.warn { background: var(--warn-soft); border-color: rgba(242, 179, 61, .35); color: #ffe0a3; }

/* toast */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.toast { min-width: 260px; max-width: 420px; padding: 12px 16px; border-radius: 10px; background: #1c2531; border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 13.5px; animation: toastIn .25s ease; border-left: 3px solid var(--good); }
.toast.bad { border-left-color: var(--bad); }
.toast.info { border-left-color: var(--info); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(4, 6, 10, .7); backdrop-filter: blur(4px); z-index: 900; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); gap: 10px; }
.modal-head h2 { flex: 1; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); background: var(--bg-2); border-radius: 0 0 14px 14px; }

/* viewer chips */
.viewer-pick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.viewer-pick label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); cursor: pointer; background: var(--bg-2); }
.viewer-pick label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.viewer-pick input { accent-color: var(--accent); margin-top: 2px; }
.viewer-pick b { display: block; font-size: 13px; }
.viewer-pick small { color: var(--muted); font-size: 11.5px; line-height: 1.35; display: block; }
@media (max-width: 560px) { .viewer-pick { grid-template-columns: 1fr; } }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { height: 32px; padding: 0 12px; border: 0; background: var(--bg-2); color: var(--text-2); font: 600 12.5px var(--font); cursor: pointer; border-right: 1px solid var(--line-2); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent-soft); color: var(--accent-2); }

/* ---------- top bar (portal) ---------- */
.topbar { position: sticky; top: 0; z-index: 50; height: 64px; display: flex; align-items: center; gap: 18px; padding: 0 28px; background: rgba(10, 13, 18, .85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none !important; }
.brand img { height: 26px; display: block; }
.brand a { display: block; transition: opacity .2s; } .brand a:hover { opacity: .8; }
.brand .sep { width: 1px; height: 22px; background: var(--line-2); }
.brand .cloud { font-size: 11px; letter-spacing: .22em; color: var(--muted); font-weight: 600; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; display: none; z-index: 60; }
.menu.open .menu-pop { display: block; }
.menu-pop a, .menu-pop button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 7px; background: none; border: 0; color: var(--text); font: 13.5px var(--font); text-align: left; cursor: pointer; text-decoration: none !important; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--panel-2); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* spinner */
.spin { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.2); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 60px; color: var(--muted); }

/* progress */
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 0; transition: width .2s; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #263140; border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- language selector (signed-in pages) ---------- */
.lang { position: relative; flex: none; }
.lang-btn { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 11px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); border-radius: 9px; cursor: pointer; font: 600 12.5px var(--font); letter-spacing: .04em; }
.lang-btn:hover { background: var(--panel-2); }
.lang-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.lang-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 70; margin: 0; padding: 6px; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: 2px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); max-height: 75vh; overflow-y: auto; }
.lang-menu li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; color: var(--text-2); outline: none; }
.lang-menu li b { font: 500 11px ui-monospace, Consolas, monospace; color: var(--muted); width: 20px; }
.lang-menu li:hover, .lang-menu li:focus { background: var(--panel-2); color: var(--text); }
.lang-menu li[aria-selected="true"] { color: var(--text); background: var(--accent-soft); }
.lang-menu li[aria-selected="true"] b { color: var(--accent-2); }
@media (max-width: 560px) { .lang-menu { position: fixed; right: 12px; left: 12px; top: 60px; grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 70vh; } .lang-btn { padding: 0 9px; height: 34px; } }
