* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: #1f2933;
  background:
    linear-gradient(135deg, rgba(255, 138, 76, 0.14), transparent 28%),
    linear-gradient(225deg, rgba(48, 176, 199, 0.16), transparent 32%),
    #f7f9fc;
}

.dark body {
  color: #f8fafc;
  background:
    linear-gradient(135deg, rgba(20, 184, 166, 0.16), transparent 28%),
    linear-gradient(225deg, rgba(249, 115, 22, 0.14), transparent 32%),
    #0f172a;
}

.dark header {
  background: linear-gradient(90deg, #1d4ed8, #0d9488, #9333ea);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: linear-gradient(90deg, #172554, #0f766e, #7c3aed);
  color: #0f172a;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}

header strong {
  color: white;
  font-weight: 800;
}

nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

nav a,
nav button {
  color: #0f172a !important;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  padding: 7px 10px;
  border-radius: 5px;
}

nav form button {
  background: white !important;
  border: 2px solid #0f172a;
  color: #0f172a !important;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #0f172a;
  font-weight: 700;
  cursor: pointer;
}

.theme-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.slider {
  position: relative;
  width: 46px;
  height: 24px;
  border: 2px solid #0f172a;
  border-radius: 999px;
  background: white;
}

.slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0f172a;
  transition: transform 160ms ease;
}

.theme-toggle input:checked + .slider::after {
  transform: translateX(22px);
}

nav a:hover,
nav button:hover {
  background: rgba(255, 255, 255, 0.5);
}

nav a.active {
  background: white;
  color: #0f172a !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
}

main {
  width: min(1100px, calc(100% - 32px));
  margin: 32px auto;
}

h1 {
  margin: 0 0 8px;
  font-size: 30px;
}

.area-head {
  margin-bottom: 18px;
  padding: 22px 24px;
  border-radius: 8px;
  color: white;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
}

.dark .area-head {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.dark .area-head p {
  color: #f8fafc;
}

.area-head p {
  margin: 0;
  opacity: 0.9;
}

.area-public .area-head {
  background: linear-gradient(135deg, #0f766e, #14b8a6);
}

.area-shared .area-head {
  background: linear-gradient(135deg, #7c2d12, #f97316);
}

.area-private .area-head {
  background: linear-gradient(135deg, #4338ca, #8b5cf6);
}

.muted {
  color: #667085;
}

.dark .muted {
  color: #dbeafe;
}

.error {
  color: #b42318;
  background: #fee4e2;
  padding: 12px;
  border-radius: 6px;
}

.notice {
  color: #05603a;
  background: #d1fadf;
  padding: 12px;
  border-radius: 6px;
}

.back {
  display: inline-block;
  margin: 12px 0;
}

.panel {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0;
  padding: 16px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: white;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.dark .panel,
.dark .login,
.dark table {
  background: #162033;
  border-color: #64748b;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.area-public .panel {
  border-top: 4px solid #14b8a6;
}

.area-shared .panel {
  border-top: 4px solid #f97316;
}

.area-private .panel {
  border-top: 4px solid #8b5cf6;
}

.stack {
  display: grid;
}

h2 {
  margin: 0;
  font-size: 20px;
}

form {
  margin: 0;
}

.login {
  display: grid;
  gap: 16px;
  max-width: 420px;
  margin-top: 24px;
  padding: 20px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: white;
}

label {
  display: grid;
  gap: 6px;
}

input {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font: inherit;
}

.dark input {
  color: #f8fafc;
  background: #0b1220;
  border-color: #94a3b8;
}

.dark input::placeholder {
  color: #cbd5e1;
}

.inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.inline input[type="checkbox"] {
  min-height: auto;
}

.admin-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.password-field {
  display: inline-flex;
  align-items: stretch;
  width: 260px;
}

.admin-form > input,
.admin-form .password-field {
  width: 260px;
}

.login input,
.login .password-field {
  width: 100%;
}

.password-field input {
  flex: 1;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.password-toggle {
  min-height: 38px;
  padding: 8px 10px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  background: #111827;
  color: white;
  white-space: nowrap;
}

.eye-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 11px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.eye-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.password-toggle.is-visible .eye-icon::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 7px;
  width: 2px;
  height: 19px;
  background: currentColor;
  transform: rotate(45deg);
}

.dark .password-toggle {
  background: #e5e7eb;
  color: #0f172a;
  border-color: #94a3b8;
}

button {
  min-height: 38px;
  padding: 8px 14px;
  border: 0;
  border-radius: 5px;
  background: #2563eb;
  color: white;
  font: inherit;
  cursor: pointer;
}

.area-public button {
  background: #0f766e;
}

.area-shared button {
  background: #ea580c;
}

.area-private button {
  background: #6d28d9;
}

button.danger {
  background: #dc2626;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background: white;
  border: 1px solid #d0d5dd;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.dark td {
  border-bottom-color: #475569;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid #eaecf0;
  text-align: left;
}

th {
  background: #e0f2fe;
  color: #0f172a;
}

.dark th {
  color: #f8fafc;
  background: #334155;
}

.dark .area-public th {
  background: #115e59;
}

.dark .area-shared th {
  background: #9a3412;
}

.dark .area-private th {
  background: #5b21b6;
}

.area-public th {
  background: #ccfbf1;
}

.area-shared th {
  background: #ffedd5;
}

.area-private th {
  background: #ede9fe;
}

tr:hover td {
  background: #f8fafc;
}

.dark tr:hover td {
  background: #24344d;
}

a {
  color: #155eef;
}

.area-public a {
  color: #0f766e;
}

.area-shared a {
  color: #c2410c;
}

.area-private a {
  color: #6d28d9;
}

.dark a {
  color: #93c5fd;
}

.dark .area-public a {
  color: #5eead4;
}

.dark .area-shared a {
  color: #fdba74;
}

.dark .area-private a {
  color: #c4b5fd;
}

.dark nav a,
.dark nav button,
.dark .theme-toggle {
  color: #0f172a !important;
}

.dark nav a.active {
  outline: 2px solid #0f172a;
}

.dark button {
  border: 1px solid rgba(255, 255, 255, 0.35);
}

td:last-child {
  width: 120px;
}

@media (max-width: 640px) {
  header {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel {
    display: grid;
  }
}
