/* Shared chrome for the Project Diagram account pages (login, dashboard,
   library, admin). The board editor has its own board.css. */

:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-2: #f1f3f8;
  --ink: #1b1f27;
  --muted: #5b6472;
  --line: #e2e6ee;
  --accent: #2f6bff;
  --accent-2: #2559e0;
  --danger: #e5484d;
  --ok: #28a86b;
  --shadow: 0 6px 24px rgba(20, 28, 48, 0.14);
  --shadow-sm: 0 2px 8px rgba(20, 28, 48, 0.1);
  --radius: 12px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---- brand ---- */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.brand .dot {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, #ffd84d, #ff6f61 45%, #2f6bff);
  box-shadow: var(--shadow-sm);
}

/* ---- buttons / inputs ---- */
.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--danger); border-color: #f3c9cb; }
.btn.danger:hover { background: #fdecec; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--ink); }
.btn.sm { padding: 6px 10px; font-size: 13px; }

.field { display: block; margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,107,255,0.12); }

.notice { border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.notice.error { background: #fdecec; color: #a3282c; }
.notice.ok { background: #e7f7ee; color: #1b7a4b; }

/* ---- top navigation bar ---- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topnav .spacer { flex: 1; }
.navlink {
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.navlink:hover { background: var(--panel-2); color: var(--ink); }
.navlink.active { color: var(--accent); background: rgba(47,107,255,0.1); }
.userchip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
}

/* ---- login page ---- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #eaf0ff, var(--bg));
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 30px 28px;
}
.login-card .brand { justify-content: center; margin-bottom: 6px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }

/* ---- page container ---- */
.page { max-width: 1120px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 24px; margin: 0; }
.page-head .spacer { flex: 1; }
.muted { color: var(--muted); }

/* ---- cards grid ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s, box-shadow 0.12s;
  cursor: pointer;
  position: relative;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card .thumb {
  height: 140px;
  background: var(--panel-2);
  background-size: cover;
  background-position: center;
  display: grid;
  place-items: center;
  color: #aab2c2;
}
.card .thumb.contain { background-size: contain; background-repeat: no-repeat; }
.card .body { padding: 12px 14px; }
.card .body .name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .body .meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.shared-badge {
  margin-left: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: rgba(47, 107, 255, 0.12);
  padding: 2px 6px;
  border-radius: 20px;
  vertical-align: middle;
}
.card .actions {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 6px; opacity: 0; transition: opacity 0.12s;
}
.card:hover .actions { opacity: 1; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px;
  border: none; background: rgba(255,255,255,0.92);
  box-shadow: var(--shadow-sm);
  display: grid; place-items: center; color: var(--muted);
}
.icon-btn:hover { color: var(--ink); background: #fff; }
.icon-btn.danger:hover { color: var(--danger); }

.new-card {
  border: 2px dashed var(--line);
  background: transparent;
  box-shadow: none;
  min-height: 200px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}
.new-card:hover { border-color: var(--accent); color: var(--accent); background: rgba(47,107,255,0.04); }
.new-card .plus { font-size: 34px; line-height: 1; margin-bottom: 6px; }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; }

/* ---- modal ---- */
.modal-back {
  position: fixed; inset: 0; background: rgba(20,28,48,0.4);
  display: grid; place-items: center; z-index: 100; padding: 20px;
}
.modal {
  width: 100%; max-width: 420px;
  background: var(--panel); border-radius: 16px; box-shadow: var(--shadow);
  padding: 22px 22px 18px;
}
.modal h2 { margin: 0 0 16px; font-size: 18px; }
.modal .row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---- tabs / segmented ---- */
.seg { display: inline-flex; background: var(--panel-2); border-radius: 10px; padding: 3px; }
.seg button { border: none; background: transparent; padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---- table (admin) ---- */
table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 12px 14px; font-size: 14px; border-bottom: 1px solid var(--line); }
table.list th { background: var(--panel-2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
table.list tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; background: var(--panel-2); color: var(--muted); }
.badge.admin { background: rgba(47,107,255,0.12); color: var(--accent); }
