:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --line: #d9e1ec;
  --text: #1f2937;
  --sub: #6b7280;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;

  --danger: #dc2626;
  --danger-hover: #b91c1c;

  --secondary: #64748b;
  --secondary-hover: #475569;

  --success: #16a34a;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
}

.wrap {
  width: 100%;
  max-width: 840px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 30px;
  font-weight: 800;
  margin-bottom: 24px;
  line-height: 1.35;
}

h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 20px;
}

h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
}

section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

#authSection,
#appSection {
  margin-bottom: 24px;
}

input,
textarea,
button {
  font: inherit;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="datetime-local"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 14px 16px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus,
input[type="datetime-local"]:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
  color: #9ca3af;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.04s ease, background-color 0.2s ease, opacity 0.2s ease;
}

button:active {
  transform: translateY(1px);
}

button:hover {
  opacity: 0.96;
}

.auth-buttons,
.top-buttons,
.form-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-buttons,
.top-buttons {
  margin-bottom: 14px;
}

.form-buttons {
  margin-top: 14px;
}

#signupBtn,
#loginBtn,
#newCaseBtn,
#saveCaseBtn {
  background: var(--primary);
  color: #fff;
}

#signupBtn:hover,
#loginBtn:hover,
#newCaseBtn:hover,
#saveCaseBtn:hover {
  background: var(--primary-hover);
}

#logoutBtn,
#cancelEditBtn {
  background: var(--secondary);
  color: #fff;
}

#logoutBtn:hover,
#cancelEditBtn:hover {
  background: var(--secondary-hover);
}

.card button:last-child {
  background: var(--danger);
  color: #fff;
}

.card button:last-child:hover {
  background: var(--danger-hover);
}

#authMsg {
  min-height: 24px;
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 600;
}

#caseForm {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbff;
}

.file-box {
  margin: 12px 0 4px;
  padding: 14px;
  border: 1px dashed #b8c6db;
  border-radius: 12px;
  background: #fff;
}

.file-box label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.file-box input[type="file"] {
  margin-bottom: 8px;
  padding: 10px 0;
  border: 0;
  background: transparent;
}

.file-box small {
  display: block;
  color: var(--sub);
  line-height: 1.5;
}

#casesList {
  margin-top: 22px;
  display: grid;
  gap: 14px;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.card p {
  margin-bottom: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.card small {
  display: block;
  color: var(--sub);
  margin-bottom: 12px;
}

.card > div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card button {
  min-width: 88px;
  padding: 10px 14px;
}

.card button:first-child {
  background: var(--primary);
  color: #fff;
}

.card button:first-child:hover {
  background: var(--primary-hover);
}

@media (max-width: 640px) {
  .wrap {
    padding: 20px 14px 40px;
  }

  section {
    padding: 18px;
    border-radius: 14px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 21px;
  }

  .auth-buttons,
  .top-buttons,
  .form-buttons,
  .card > div {
    flex-direction: column;
  }

  button,
  .card button {
    width: 100%;
  }
}

.notice-box {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-weight: 600;
  line-height: 1.6;
}