/* Bookerndy Cloud: ocean theme */
:root {
  --abyss: #03111a;
  --deep: #06283d;
  --ocean: #0a4a73;
  --tide: #1479a8;
  --surf: #33b8d9;
  --foam: #c4f0f8;
  --coral: #ff7a6b;
  --kelp: #3fd9a8;
  --amber: #ffc65a;
  --text: #e6f6fb;
  --muted: #8fb4c4;
  --line: rgba(196, 240, 248, .15);
  --glass: rgba(8, 52, 82, .55);
  --radius: 18px;
  color-scheme: dark;
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }
body {
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 50% -8%, rgba(51, 184, 217, .38), transparent 62%),
    linear-gradient(180deg, #0a4a73 0%, #06283d 36%, #03111a 100%);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  line-height: 1.45;
}

/* ---------- sea backdrop ---------- */
.sea { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.rays {
  position: absolute; inset: -20% -10% 30% -10%;
  background: repeating-linear-gradient(105deg, rgba(196,240,248,.07) 0 60px, transparent 60px 150px);
  mask-image: linear-gradient(180deg, #000, transparent 85%);
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%);
  animation: sway 14s ease-in-out infinite alternate;
}
.wave { position: absolute; left: -5%; width: 110%; bottom: -2px; height: 22vh; min-height: 120px; }
.w1 { fill: rgba(20, 121, 168, .35); animation: drift 11s ease-in-out infinite alternate; }
.w2 { fill: rgba(3, 17, 26, .75); height: 16vh; animation: drift 8s ease-in-out infinite alternate-reverse; }
@keyframes drift { from { transform: translateX(-2.5%); } to { transform: translateX(2.5%); } }
@keyframes sway  { from { transform: translateX(-3%) skewX(-2deg); } to { transform: translateX(3%) skewX(2deg); } }

/* ---------- layout ---------- */
.top, .wrap, .foot { position: relative; z-index: 1; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px max(16px, 4vw);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: .2px; font-size: 1.15rem; }
.brand em { font-style: normal; font-weight: 500; color: var(--surf); margin-left: 6px; }
.logo-bg { fill: var(--ocean); }
.logo-wave { fill: none; stroke: var(--surf); stroke-width: 2.6; stroke-linecap: round; }
.who { display: flex; align-items: center; gap: 10px; font-size: .92rem; color: var(--muted); }
.who strong { color: var(--text); }
.badge { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--foam); background: rgba(51, 184, 217, .14); }

.wrap { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 12px max(16px, 4vw) 120px; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 0 18px; letter-spacing: .12em; text-transform: lowercase; }

h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.sub { color: var(--muted); margin: 6px 0 0; }

/* ---------- cards ---------- */
.card {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(196, 240, 248, .08);
}
.login { max-width: 420px; margin: 8vh auto 0; }
.login h1 { margin-bottom: 4px; }
.stack { display: grid; gap: 14px; margin-top: 18px; }

label { display: grid; gap: 6px; font-size: .86rem; color: var(--muted); }
input[type=text], input[type=password], input:not([type]) {
  width: 100%;
  padding: 11px 13px;
  font: inherit;
  color: var(--text);
  background: rgba(3, 17, 26, .55);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}
input:focus { border-color: var(--surf); box-shadow: 0 0 0 3px rgba(51, 184, 217, .25); }
input::placeholder { color: rgba(143, 180, 196, .6); }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 10px 16px; border-radius: 12px; border: 1px solid transparent;
  color: var(--text); background: rgba(196, 240, 248, .08);
  transition: transform .12s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); background: rgba(196, 240, 248, .14); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--foam); outline-offset: 2px; }
.btn.primary { background: linear-gradient(135deg, var(--surf), var(--tide)); color: #021019; border-color: rgba(196, 240, 248, .35); box-shadow: 0 8px 24px rgba(51, 184, 217, .28); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(135deg, #52c8e6, #1b8dc0); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.danger { background: transparent; border-color: rgba(255, 122, 107, .55); color: var(--coral); }
.btn.danger:hover:not(:disabled) { background: rgba(255, 122, 107, .16); }
.btn.small { padding: 6px 11px; font-size: .85rem; border-radius: 10px; }
.btn.big { padding: 14px 26px; font-size: 1.05rem; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.err { color: var(--coral); min-height: 1.3em; margin: 0; font-size: .92rem; }
.hint { color: var(--muted); font-size: .88rem; margin: 0; }

/* ---------- desktop card ---------- */
.desk { margin-top: 22px; display: grid; gap: 20px; }
.desk-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.desk-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.desk-title h2 { font-size: 1.5rem; overflow-wrap: anywhere; }
.rename { display: flex; gap: 8px; flex-wrap: wrap; }
.rename input { min-width: 220px; }

.pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 99px; font-size: .85rem; font-weight: 600; border: 1px solid var(--line); background: rgba(3, 17, 26, .4); }
.pill i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: block; }
.pill.running i { background: var(--kelp); box-shadow: 0 0 10px var(--kelp); }
.pill.starting i { background: var(--amber); animation: pulse 1s ease-in-out infinite; }
.pill.stopped i { background: var(--muted); }
@keyframes pulse { 50% { opacity: .25; transform: scale(.8); } }

.meter-wrap { display: grid; gap: 8px; }
.meter-label { display: flex; justify-content: space-between; font-size: .88rem; color: var(--muted); }
.meter { height: 10px; border-radius: 99px; background: rgba(3, 17, 26, .6); overflow: hidden; border: 1px solid var(--line); }
.meter b { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--tide), var(--surf), var(--foam)); transition: width .6s ease; }
.meter.warn b { background: linear-gradient(90deg, var(--amber), var(--coral)); }

/* ---------- admin ---------- */
.page-head { margin: 18px 0 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { padding: 16px 18px; }
.tile small { color: var(--muted); display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.tile strong { font-size: 1.6rem; display: block; margin-top: 4px; }
.create { margin-bottom: 20px; }
.create h2 { font-size: 1.15rem; margin-bottom: 12px; }
.create form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.users { display: grid; gap: 12px; }
.urow { display: grid; grid-template-columns: 1.1fr 1.3fr .8fr 1fr; gap: 14px; align-items: center; padding: 16px 18px; }
.urow .name { font-weight: 700; font-size: 1.05rem; overflow-wrap: anywhere; }
.urow .meta { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.urow .acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.empty { text-align: center; color: var(--muted); padding: 30px; }

/* ---------- dialog + toasts ---------- */
dialog.dlg {
  color: var(--text); background: linear-gradient(180deg, #0b3a58, #06283d);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  width: min(440px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}
dialog.dlg::backdrop { background: rgba(2, 10, 16, .7); backdrop-filter: blur(4px); }
dialog.dlg h3 { margin-bottom: 8px; font-size: 1.2rem; }
dialog.dlg p { color: var(--muted); margin: 0 0 14px; }
dialog.dlg form { display: grid; gap: 14px; }

.toasts { position: fixed; z-index: 20; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: #0a3a58; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); animation: rise .25s ease; }
.toast.error { border-color: rgba(255, 122, 107, .6); }
.toast.ok { border-color: rgba(63, 217, 168, .6); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.notice { color: var(--amber); }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  .create form { grid-template-columns: 1fr; }
  .urow { grid-template-columns: 1fr 1fr; }
  .rename input { min-width: 0; flex: 1; }
  .btn.big { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
