/* ALG Customer Portal — logo on black, minimal chrome.
   Palette matches the corporate site: near-black bg, ALG red accent. */
:root {
  --black: #0a0a0b;
  --panel: #131316;
  --border: #26262b;
  --text: #f2f2f4;
  --muted: #9a9aa4;
  --red: #e10600;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--black);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ------------------------------------------------------- site header
   Carried over from the corporate site verbatim (Anton, 2026-08-19):
   same sticky bar, blur, border and 72px height, same 38px logo. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(10, 10, 11, 0.72);
  border-bottom: 1px solid var(--border);
}

/* Logo left, controls right - same geometry as the corporate site.
   (Anton, 2026-08-19: no menu items and no centred label.) */
.header-inner {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.site-header .logo { display: block; flex: 0 0 auto; }
.site-header .logo img { height: 38px; width: auto; display: block; }

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
}

.who {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 0;   /* lets the name truncate instead of pushing the row wider */
}

/* The signed-in name must stay visible at every width (Anton, 2026-08-19:
   it was disappearing on portrait mobile). Long names ellipsize rather than
   being hidden or forcing the header to overflow. */
.who .u {
  min-width: 0;
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------- language switch
   Copied from the corporate site so the control looks and behaves
   identically (Anton, 2026-08-19: keep the language selector). */
.lang-switch {
  position: relative;
  margin-left: 8px;
  padding-left: 18px;
  border-left: 1px solid var(--border);
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-transform: uppercase;
}

.lang-flag {
  width: 22px;
  height: 16px;
  display: block;
  object-fit: cover;
  border-radius: 2px;
  flex: none;
}

.lang-caret { transition: transform 0.2s ease; }
.lang-switch.open .lang-caret { transform: rotate(180deg); }

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 104px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: rgba(10, 10, 11, 0.97);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 60;
}

.lang-menu.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.lang-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 6px;
  text-transform: uppercase;
}

.lang-menu a:hover { color: var(--text); background: var(--panel); }
.lang-menu a.active { color: #fff; background: var(--red); }
.who .out {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--muted);
}
.who .out:hover { color: var(--text); border-color: #3a3a42; }

@media (max-width: 820px) {
  .header-inner { padding: 0 16px; height: 64px; }
  .site-header .logo img { height: 30px; }
  .header-right { gap: 10px; }
  .lang-switch { margin-left: 4px; padding-left: 12px; }
}

@media (max-width: 520px) {
  /* Space is won from paddings and the language label, NOT by hiding the user. */
  .header-right { gap: 8px; }
  .who { gap: 8px; font-size: 0.8rem; }
  .who .u { max-width: 9ch; }
  .who .out { padding: 5px 9px; font-size: 0.75rem; }
  /* Flag alone is enough at this width. */
  .lang-toggle > span { display: none; }
  .lang-toggle { padding: 5px 7px; gap: 4px; }
  .lang-switch { margin-left: 0; padding-left: 8px; }
}

@media (max-width: 380px) {
  /* Smallest phones: shrink the logo before sacrificing the username. */
  .header-inner { padding: 0 12px; }
  .site-header .logo img { height: 26px; }
  .who .u { max-width: 7ch; }
}

/* ---------------------------------------------------------------- login */
.login-wrap {
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
}

.login label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}

.login input {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
  padding: 12px 14px;
  margin-bottom: 18px;
  outline: none;
  width: 100%;
}
.login input:focus { border-color: var(--red); }

.login button {
  background: var(--red);
  border: 0;
  border-radius: 10px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 13px 16px;
  margin-top: 6px;
  cursor: pointer;
}
.login button:hover { filter: brightness(1.08); }

.err {
  background: rgba(225, 6, 0, 0.1);
  border: 1px solid rgba(225, 6, 0, 0.45);
  border-radius: 10px;
  color: #ff8b86;
  font-size: 0.86rem;
  margin: 0 0 20px;
  padding: 10px 13px;
  text-align: center;
}

/* ------------------------------------------------------------------ hub */
.hub-wrap {
  min-height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 300px));
  gap: 26px;
  width: 100%;
  max-width: 640px;
}

.tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 38px 26px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: border-color .15s, transform .15s;
}
.tile:hover { border-color: var(--red); transform: translateY(-2px); }

.tile svg {
  width: 54px;
  height: 54px;
  margin-bottom: 20px;
  fill: none;
  stroke: var(--red);
  stroke-width: 2.2;
  stroke-linejoin: round;
}
.tile .t { font-size: 1.08rem; font-weight: 600; }
.tile .s { font-size: 0.82rem; color: var(--muted); margin-top: 8px; }

.tile.disabled {
  opacity: 0.45;
  cursor: default;
}
.tile.disabled:hover { border-color: var(--border); transform: none; }
.tile.disabled svg { stroke: var(--muted); }

@media (max-width: 620px) {
  .tiles { grid-template-columns: 1fr; max-width: 340px; }
}

/* -------------------------------------------------------------- browser */
.browse {
  max-width: 940px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}

.crumbs {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs .home {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  margin-right: 8px;
}

.list { list-style: none; margin: 0; padding: 0; }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  padding: 0 6px;
}
.row > a {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  padding: 14px 0;
}
.row:hover { background: rgba(255, 255, 255, 0.025); }
.row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .mt { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.row .sz { color: var(--muted); font-size: 0.8rem; width: 78px; text-align: right; white-space: nowrap; }
.row .dl {
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 6px 12px;
  white-space: nowrap;
}
.row .dl:hover { color: var(--text); border-color: var(--red); }

.ic {
  width: 20px; height: 20px;
  flex: 0 0 20px;
  background: var(--muted);
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: contain; mask-size: contain;
}
.ic.folder {
  background: var(--red);
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M3 6a2 2 0 0 1 2-2h5l2 2.5h7a2 2 0 0 1 2 2V18a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M3 6a2 2 0 0 1 2-2h5l2 2.5h7a2 2 0 0 1 2 2V18a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/></svg>");
}
.ic.image, .ic.vector, .ic.archive, .ic.video, .ic.file {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 2h8l4 4v16H6z' fill='none' stroke='black' stroke-width='2'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 2h8l4 4v16H6z' fill='none' stroke='black' stroke-width='2'/></svg>");
}

.empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 28px 6px;
  list-style: none;
}

@media (max-width: 560px) {
  .row .mt { display: none; }
  .browse { padding-top: 28px; }
  .login-wrap, .hub-wrap { min-height: calc(100vh - 64px); }
}

/* ---------------------------------------------------------------- preview
   Clicking a file name used to hit the folder route and 404 (Anton, 2026-08-19).
   Files now open here instead. */
.pv-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(3px);
}
.pv-overlay[hidden] { display: none; }

.pv-box {
  display: flex;
  flex-direction: column;
  width: min(1000px, 100%);
  height: min(78vh, 820px);
  background: #121215;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.pv-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #16161a;
}
.pv-title {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  /* Long design filenames must not push the buttons out of the dialog. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pv-dl {
  flex: none;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.pv-dl:hover { border-color: var(--red); color: var(--red); }

.pv-x {
  flex: none;
  width: 30px;
  height: 30px;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.pv-x:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

/* Checkerboard: white and transparent logos are both common here, and a plain
   dark panel makes white-on-transparent art look like it is missing. */
.pv-body {
  flex: 1;
  min-height: 0;
  background:
    linear-gradient(45deg, #1b1b1f 25%, transparent 25%, transparent 75%, #1b1b1f 75%),
    linear-gradient(45deg, #1b1b1f 25%, transparent 25%, transparent 75%, #1b1b1f 75%),
    #131316;
  background-position: 0 0, 11px 11px;
  background-size: 22px 22px;
}
.pv-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Standalone preview page (middle-click / no JS). */
.pv-page .pv-standalone {
  height: min(70vh, 720px);
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.pv-page .crumbs .dl {
  margin-left: auto;
  padding: 5px 11px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
}

@media (max-width: 700px) {
  .pv-overlay { padding: 12px; }
  .pv-box { height: 86vh; }
  .pv-head { padding: 10px 10px 10px 14px; gap: 10px; }
  .pv-title { font-size: 0.82rem; }
}
