/* Kyudo City MDT & UCP - Exact Design Tokens matching kyudo.city */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;450;500;550;600;650;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  --bg: #0c0d10;
  --surface: #131419;
  --surface2: #1b1c23;
  --text: #f4f3f7;
  --muted: #9999a6;
  --border: #292a33;
  --accent: #6600ff;
  --accent-soft: #a780ff;
  --tint: #201438;
  --header: rgba(12, 13, 16, 0.88);
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.3);

  --font-body: 'DM Sans', sans-serif;
  --font-heading: 'Space Grotesk', sans-serif;

  --badge-pd: #3b82f6;
  --badge-sheriff: #f59e0b;
  --badge-doj: #10b981;
  --badge-active: #22c55e;
  --badge-pending: #eab308;
  --badge-danger: #ef4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(102, 0, 255, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(167, 128, 255, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
}

h1, h2, h3, h4, .brand-title, .module-title {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Shell Layout */
.shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #4000a5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 24px;
  color: #fff;
  box-shadow: 0 0 25px rgba(102, 0, 255, 0.4);
}

.brand-text h2 {
  font-size: 19px;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.2;
}

.brand-text p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-item.active {
  background: var(--tint);
  color: var(--accent-soft);
  border-left: 3px solid var(--accent);
  font-weight: 600;
}

.user-profile {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  object-fit: cover;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dept {
  font-size: 12px;
  color: var(--muted);
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-logout:hover {
  color: var(--badge-danger);
}

/* Main Workspace */
.main-content {
  padding: 40px 48px;
  overflow-y: auto;
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 36px;
}

.module-title {
  font-size: 28px;
  letter-spacing: -0.04em;
}

/* Kyudo Panels & Cards */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.panel-title {
  font-size: 18px;
  font-family: var(--font-heading);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: var(--accent);
  color: #fff;
}

.btn:hover {
  background: #5200cc;
  box-shadow: 0 0 15px rgba(102, 0, 255, 0.4);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--badge-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: var(--badge-danger);
  color: #fff;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.input, .select, .textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(167, 128, 255, 0.15);
}

/* Tables */
.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  background: var(--surface2);
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background: rgba(27, 28, 35, 0.6);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-pd { background: rgba(59, 130, 246, 0.15); color: var(--badge-pd); border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-sheriff { background: rgba(245, 158, 11, 0.15); color: var(--badge-sheriff); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-doj { background: rgba(16, 185, 129, 0.15); color: var(--badge-doj); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-active { background: rgba(34, 197, 94, 0.15); color: var(--badge-active); border: 1px solid rgba(34, 197, 94, 0.3); }
.badge-pending { background: rgba(234, 179, 8, 0.15); color: var(--badge-pending); border: 1px solid rgba(234, 179, 8, 0.3); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--badge-danger); border: 1px solid rgba(239, 68, 68, 0.3); }

/* Login / Special Frames */
.login-frame {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  background-image: 
    radial-gradient(circle at 50% 30%, rgba(102, 0, 255, 0.18) 0%, transparent 60%);
}

.login-card {
  width: 100%;
  max-width: 440px;
  text-align: center;
  padding: 40px;
}

.login-footer {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.login-footer a {
  color: var(--muted);
  transition: color 0.2s;
}

.login-footer a:hover {
  color: var(--accent-soft);
}

/* Toast Notification */
#toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--surface2);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 14px 22px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-weight: 500;
  z-index: 9999;
  display: empty ? none : block;
}
#toast:empty { display: none; }
