/* Internship Evidence – shared styles
 *
 * The palette follows the emc.academy site (emc-web): near-black surfaces with white accents
 * in the dark theme, and the same neutral scale inverted in the light theme. Semantic colours
 * (danger, success, warning, night shift) are the only hues. The theme is the data-theme
 * attribute on <html> ("light" | "dark"), set by js/theme.js – system preference by default,
 * toggled with the button in the page header. The layout uses the whole viewport width.
 */
:root {
  color-scheme: light;
  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #f6f6f7;
  --text: #18181a;
  --muted: #5c5e6a;
  --dim: #7c7f8c;
  --border: rgba(24, 24, 26, .11);
  --border-strong: rgba(24, 24, 26, .24);
  --accent: #18181a;
  --accent-hover: #35363c;
  --accent-soft: rgba(24, 24, 26, .06);
  --on-accent: #ffffff;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --success: #1a7a43;
  --success-soft: #e3f5ea;
  --warn: #9a5b00;
  --warn-soft: #fff1dc;
  --night: #5b3fb8;
  --night-soft: #ece7fb;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 17, 20, .05), 0 6px 20px rgba(16, 17, 20, .05);
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: clamp(1rem, 2vw, 2rem);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #18181a;
  --surface: #1d1e20;
  --surface-2: #242528;
  --text: #ffffff;
  --muted: #a6a9b6;
  --dim: #727586;
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .22);
  --accent: #ffffff;
  --accent-hover: #d4d4d8;
  --accent-soft: rgba(255, 255, 255, .06);
  --on-accent: #18181a;
  --danger: #f28b82;
  --danger-soft: #3a1f1f;
  --success: #5fd08a;
  --success-soft: #16331f;
  --warn: #f3b35b;
  --warn-soft: #3a2c12;
  --night: #b19cf5;
  --night-soft: #2a2245;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
/* Class display rules (.btn, .badge…) would otherwise override the hidden attribute */
[hidden] { display: none !important; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3 { margin: 0 0 .4rem; line-height: 1.25; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0 0 .6rem; }
small, .muted { color: var(--muted); }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }

/* ---- Header ---- */
.topbar {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  padding: .6rem var(--gutter);
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: inherit; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; font-weight: 800; font-size: .95rem; letter-spacing: .02em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-title { font-weight: 700; font-size: 1.05rem; }
.brand-sub { font-size: .8rem; color: var(--muted); }
.topbar-nav { margin-left: auto; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.topbar-nav select.lang-select {
  width: auto; min-height: 34px; padding: .25rem 1.8rem .25rem .6rem; font-size: .8rem; font-weight: 600;
  background-position: right .5rem center; cursor: pointer;
}
.theme-toggle { padding: 0; width: 34px; }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .ico-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .ico-moon { display: none; }
.version-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  font-family: var(--mono); font-size: .75rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: .2rem .6rem; min-height: 28px;
}
.update-btn {
  font: inherit; font-size: .9rem; line-height: 1; cursor: pointer; border: 0; border-radius: 999px;
  background: var(--success); color: #fff; width: 20px; height: 20px; padding: 0; display: grid; place-items: center;
  animation: spin 2.4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Layout ---- */
main { padding: 1.25rem var(--gutter) 2.5rem; }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
/* Two cards side by side; each keeps its own bottom margin only when stacked */
.grid > .card { margin-bottom: 0; }
.grid { margin-bottom: 1.25rem; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem 1.25rem 1.25rem; margin-bottom: 1.25rem;
}
.card-quiet { box-shadow: none; background: transparent; }
.card-head { display: flex; align-items: flex-start; gap: .8rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.card-head h2 { margin: 0; }
.card-head .spacer { flex: 1; }
.card-title { display: flex; gap: .7rem; align-items: flex-start; min-width: 0; flex: 1 1 260px; }
.card-title .hint { margin: .15rem 0 0; font-size: .82rem; color: var(--muted); }
.step {
  flex: none; width: 26px; height: 26px; border-radius: 50%; margin-top: .05rem;
  background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: .8rem;
  display: grid; place-items: center;
}
.card-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-left: auto; }

.notice {
  display: flex; gap: .7rem; align-items: flex-start;
  border-radius: var(--radius-sm); padding: .65rem .9rem; font-size: .88rem; margin-bottom: 1.25rem;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); color: var(--muted);
}
.notice strong { color: var(--text); }
.notice.warn { border-left-color: var(--warn); }
.notice.success { border-left-color: var(--success); }
.notice.danger { border-left-color: var(--danger); }
.notice .ico { font-size: 1.05rem; line-height: 1.3; }

/* ---- Forms ---- */
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field label { font-size: .82rem; font-weight: 600; color: var(--muted); }
.field .hint { font-size: .75rem; color: var(--muted); }
input[type="text"], input[type="date"], input[type="search"], input[type="number"], select, textarea {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: .55rem .7rem; min-height: 42px;
  width: 100%; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
input:invalid.touched, .invalid { border-color: var(--danger) !important; }
select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888b96' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right .7rem center; padding-right: 2rem;
}
.time-picker { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .3rem; }
.time-picker .sep { font-weight: 700; color: var(--muted); }
.form-row { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .9rem; }
.checkbox { display: inline-flex; align-items: center; gap: .45rem; font-size: .9rem; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: inherit; font-weight: 600; font-size: .9rem;
  border-radius: var(--radius-sm); padding: .55rem .95rem; border: 1px solid var(--border-strong); cursor: pointer;
  background: var(--surface); color: var(--text); text-decoration: none; transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap; min-height: 40px;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; min-height: 34px; }
.btn-icon { padding: .3rem .5rem; min-width: 34px; }
.btn-file input[type="file"] { display: none; }

/* ---- Tables ---- */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 640px; }
table.data th, table.data td { padding: .55rem .75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data th {
  background: var(--surface-2); color: var(--muted); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--text); }
table.data th .sort-ind { opacity: .5; margin-left: .25rem; font-size: .7rem; }
table.data th.sorted { color: var(--text); }
table.data th.sorted .sort-ind { opacity: 1; }
table.data tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
table.data tbody tr:hover { background: var(--accent-soft); }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tfoot td { font-weight: 700; background: var(--surface-2); }
table.data .actions { white-space: nowrap; text-align: right; }
table.data tr.editing, table.data tbody tr.editing:hover { background: var(--night-soft); }
.empty { padding: 1.5rem; text-align: center; color: var(--muted); }

.badge {
  display: inline-block; font-size: .72rem; font-weight: 600; padding: .15rem .5rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--muted); white-space: nowrap;
}
.badge-night { background: var(--night-soft); color: var(--night); border-color: transparent; }
.badge-ok { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-err { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-accent { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.badge-wrap { white-space: normal; }

/* ---- Stats ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .7rem .9rem; }
.stat .label { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- Tabs (evidence lists) ---- */
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.tab {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: .4rem .9rem;
  font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; color: var(--muted);
}
.tab.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tab:hover:not(.active) { color: var(--text); background: var(--surface-2); }

/* ---- Drop zone & file list ---- */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 1.6rem; text-align: center;
  color: var(--muted); transition: border-color .15s, background .15s; cursor: pointer;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.file-list li {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .88rem; flex-wrap: wrap;
}
.file-list .fname { font-weight: 600; word-break: break-all; }
.file-list .fmeta { color: var(--muted); font-size: .8rem; }
.file-list .spacer { flex: 1; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }

/* ---- Footer ---- */
footer.site { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .84rem; }
.footer-inner {
  padding: 1.5rem var(--gutter) 1.2rem;
  display: flex; gap: 1.25rem 2.5rem; flex-wrap: wrap; justify-content: space-between; align-items: center;
}
.footer-brand { display: flex; align-items: center; gap: 1rem; }
.footer-logo { display: inline-flex; color: var(--text); text-decoration: none; }
.emc-logo { height: 46px; width: auto; display: block; }
.footer-text { display: flex; flex-direction: column; gap: .1rem; }
.footer-text strong { color: var(--text); }
.footer-bottom {
  border-top: 1px solid var(--border); padding: .8rem var(--gutter) 1.4rem;
  display: flex; gap: .4rem 1.5rem; flex-wrap: wrap; justify-content: space-between; font-size: .8rem; color: var(--dim);
}

/* ---- Toasts ---- */
#toast-host { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 100; max-width: min(420px, 92vw); }
.toast {
  background: var(--text); color: var(--bg); padding: .7rem .95rem; border-radius: var(--radius-sm); font-size: .9rem;
  box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: none; }
.toast-error { background: var(--danger); color: #fff; }
.toast-success { background: var(--success); color: #fff; }
.toast-warn { background: var(--warn); color: #fff; }
:root[data-theme="dark"] .toast-error, :root[data-theme="dark"] .toast-success, :root[data-theme="dark"] .toast-warn { color: #18181a; }

/* ---- Dialog ---- */
dialog {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  padding: 1.2rem 1.4rem; max-width: 520px; width: calc(100% - 2rem); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(10, 10, 12, .6); }
dialog .dialog-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.inline-list { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .25rem .9rem; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

@media (max-width: 720px) {
  .brand-sub { display: none; }
  .topbar-nav { gap: .4rem; }
  .emc-logo { height: 38px; }
}
