:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --accent: #06b6d4;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.06);
  --radius: 12px;
}

html[data-theme="dark"] {
  --bg: #0f172a;
  --card-bg: #1e293b;
  --border: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
}

/* header */
header.app-header {
  background: linear-gradient(120deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

header.app-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 85% -20%, rgba(255, 255, 255, 0.25), transparent 55%);
  pointer-events: none;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.header-title .logo-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.5px;
  backdrop-filter: blur(4px);
}

header.app-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

header.app-header .subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  opacity: 0.85;
}

.theme-toggle {
  position: relative;
  z-index: 1;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.32);
  transform: rotate(15deg);
}

.container {
  max-width: 1080px;
  margin: 28px auto;
  padding: 0 20px 40px;
}

/* stat cards */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.5s ease forwards;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
}

.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.stat-dot.total { background: var(--primary); }
.stat-dot.done { background: #22c55e; }
.stat-dot.pending { background: #eab308; }
.stat-dot.reject { background: #ef4444; }

/* toolbar */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.toolbar input[type="text"] {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--card-bg);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.toolbar input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(120deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn:active {
  transform: translateY(0);
}

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

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

.btn.danger {
  background: #fff;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.btn.danger:hover {
  background: #fee2e2;
}

html[data-theme="dark"] .btn.danger {
  background: transparent;
  border-color: rgba(239, 68, 68, 0.4);
}

html[data-theme="dark"] .btn.danger:hover {
  background: rgba(239, 68, 68, 0.12);
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: var(--bg);
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  opacity: 0;
  transform: translateY(6px);
  animation: fadeInUp 0.4s ease forwards;
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: var(--bg);
  cursor: pointer;
}

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

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status.done {
  background: #dcfce7;
  color: #16a34a;
}

.status.pending {
  background: #fef9c3;
  color: #ca8a04;
}

.status.reject {
  background: #fee2e2;
  color: #dc2626;
}

html[data-theme="dark"] .status.done { background: rgba(34, 197, 94, 0.15); }
html[data-theme="dark"] .status.pending { background: rgba(234, 179, 8, 0.15); }
html[data-theme="dark"] .status.reject { background: rgba(239, 68, 68, 0.15); }

.row-delete-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.row-delete-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 16px;
}

/* detail page */
.detail-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px 16px;
  padding: 28px;
}

.detail-grid dt {
  color: var(--text-muted);
  font-size: 13px;
  padding-top: 6px;
  font-weight: 600;
}

.detail-grid dd {
  margin: 0;
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: gap 0.15s ease;
}

.back-link:hover {
  gap: 10px;
}

.section-title {
  padding: 18px 28px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 28px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(120deg, rgba(99, 102, 241, 0.08), rgba(6, 182, 212, 0.08));
}

.avatar-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--primary), var(--accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  flex-shrink: 0;
}

.detail-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.detail-header .name {
  font-size: 20px;
  font-weight: 700;
}

.detail-header .sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* form */
.detail-form {
  padding: 24px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-row input[type="text"],
.form-row select,
.form-row textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--card-bg);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-row input[type="text"]:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-row select {
  cursor: pointer;
}

.form-error {
  color: #dc2626;
  font-size: 13px;
  margin: 0;
  min-height: 1em;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
