:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #697386;
  --line: #dfe4ea;
  --paper: #f6f8fb;
  --panel: #ffffff;
  --orange: #e87522;
  --orange-dark: #b84f10;
  --green: #0f8b62;
  --blue: #2364aa;
  --shadow: 0 22px 55px rgba(24, 33, 47, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(232, 117, 34, 0.12), rgba(35, 100, 170, 0.11)),
    var(--paper);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
}

.brand-panel,
.dashboard {
  background: var(--panel);
  border: 1px solid rgba(24, 33, 47, 0.08);
  box-shadow: var(--shadow);
}

.brand-panel {
  border-radius: 8px;
  padding: 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
}

.mobile-title {
  display: none;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--orange-dark);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 280px;
  font-size: clamp(3.7rem, 5.8vw, 4.35rem);
  line-height: 1.04;
  letter-spacing: 0;
  word-break: keep-all;
}

.tagline {
  max-width: 260px;
  margin: 20px 0 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 1rem;
}

.ball-visual {
  width: min(260px, 72vw);
  aspect-ratio: 1;
  margin-top: 38px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, #ffb55f 0 16%, transparent 17%),
    linear-gradient(145deg, #f99434, #d85e16);
  border: 6px solid #8d3d10;
  position: relative;
  align-self: center;
  box-shadow: inset -18px -20px 0 rgba(96, 37, 9, 0.18), 0 20px 36px rgba(216, 94, 22, 0.24);
}

.mini-ball {
  width: 54px;
  aspect-ratio: 1;
  border-radius: 50%;
  flex: 0 0 auto;
  background:
    linear-gradient(90deg, transparent 47%, #7a310b 48% 52%, transparent 53%),
    linear-gradient(160deg, transparent 39%, #7a310b 40% 44%, transparent 45%),
    radial-gradient(circle at 35% 28%, #ffbd6d 0 18%, transparent 19%),
    linear-gradient(145deg, #f99434, #d85e16);
  border: 3px solid #8d3d10;
  box-shadow: inset -6px -7px 0 rgba(96, 37, 9, 0.16);
}

.ball-line {
  position: absolute;
  display: block;
  background: #7a310b;
  opacity: 0.9;
}

.line-a {
  width: 7px;
  height: 100%;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}

.line-b,
.line-c {
  width: 72%;
  height: 7px;
  left: 14%;
  border-radius: 999px;
}

.line-b {
  top: 30%;
  transform: rotate(-18deg);
}

.line-c {
  bottom: 28%;
  transform: rotate(18deg);
}

.dashboard {
  border-radius: 8px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #fbfcfe;
}

.metric span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.metric strong {
  font-size: 2.3rem;
  line-height: 1;
}

.control-panel {
  display: grid;
  gap: 12px;
}

.borrow-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.field-group {
  display: grid;
  gap: 8px;
}

label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

input {
  width: 100%;
  height: 48px;
  border: 1px solid #cdd5df;
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(35, 100, 170, 0.14);
}

.primary-button,
.return-button,
.text-button {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  height: 48px;
  padding: 0 22px;
  color: #fff;
  background: var(--orange);
}

.primary-button:hover {
  background: var(--orange-dark);
}

.primary-button:disabled {
  cursor: not-allowed;
  background: #aab3c0;
}

.notice {
  min-height: 44px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #eef6ff;
  color: #164c80;
  font-weight: 700;
}

.notice.warning {
  background: #fff3e8;
  color: #9b420c;
}

.notice.success {
  background: #eaf8f2;
  color: #08724d;
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

h2 {
  margin: 0;
  font-size: 1.25rem;
}

.text-button {
  min-height: 38px;
  padding: 0 12px;
  background: #edf1f5;
  color: #344054;
}

.text-button:hover {
  background: #dfe5ec;
}

.loan-list {
  display: grid;
  gap: 10px;
}

.empty-state {
  min-height: 170px;
  border: 1px dashed #b9c3d0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  padding: 24px;
}

.loan-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.loan-person {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: baseline;
}

.loan-person strong {
  font-size: 1.05rem;
}

.loan-person span,
.loan-time {
  color: var(--muted);
  font-size: 0.92rem;
}

.loan-time {
  margin-top: 6px;
}

.return-button {
  min-width: 88px;
  height: 42px;
  padding: 0 14px;
  color: #fff;
  background: var(--green);
}

.return-button:hover {
  background: #0a704f;
}

.returned {
  opacity: 0.64;
}

.returned .return-button {
  background: #8792a2;
  cursor: default;
}

@media (max-width: 880px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: 360px;
  }

  .borrow-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  body {
    background: var(--paper);
  }

  .app-shell {
    width: 100%;
    min-height: 100svh;
    padding: 0;
    gap: 0;
  }

  .dashboard {
    order: 1;
    min-height: 100svh;
    border: 0;
    border-radius: 0;
    padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
    gap: 16px;
    box-shadow: none;
  }

  .brand-panel {
    order: 2;
    min-height: auto;
    margin: 0 16px 16px;
    padding: 20px;
    box-shadow: none;
  }

  .brand-panel .eyebrow,
  .brand-panel h1,
  .brand-panel .tagline {
    display: none;
  }

  .ball-visual {
    width: min(170px, 54vw);
    margin: 0 auto;
  }

  .mobile-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
  }

  .mobile-title .eyebrow {
    margin-bottom: 6px;
    font-size: 0.72rem;
  }

  .mobile-title h1 {
    max-width: none;
    font-size: 2rem;
    line-height: 1.08;
    white-space: nowrap;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .metric {
    min-height: 82px;
    padding: 12px 10px;
  }

  .metric span {
    font-size: 0.78rem;
    word-break: keep-all;
  }

  .metric strong {
    font-size: 2rem;
  }

  .borrow-form {
    gap: 10px;
  }

  label {
    font-size: 0.84rem;
  }

  input,
  .primary-button {
    height: 52px;
  }

  .primary-button {
    width: 100%;
    font-size: 1rem;
  }

  .notice {
    padding: 12px;
    font-size: 0.92rem;
  }

  .list-header,
  .loan-item {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .list-header {
    flex-direction: column;
    gap: 10px;
  }

  h2 {
    width: 100%;
    font-size: 1.12rem;
  }

  .text-button,
  .return-button {
    width: 100%;
  }

  .empty-state {
    min-height: 140px;
    padding: 20px;
  }

  .loan-item {
    padding: 14px;
  }
}

@media (max-width: 360px) {
  .dashboard {
    padding-left: 12px;
    padding-right: 12px;
  }

  .mobile-title h1 {
    font-size: 1.75rem;
  }

  .mini-ball {
    width: 46px;
  }

  .metric {
    padding: 10px 8px;
  }

  .metric span {
    font-size: 0.72rem;
  }

  .metric strong {
    font-size: 1.75rem;
  }
}
