:root{
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef4f8;
  --text: #1f2a37;
  --muted: #66768a;
  --border: #d9e3ec;

  --primary: #6f96c9;
  --primary-hover: #5d84b8;
  --secondary: #9bb7d7;

  --success: #4f8a6b;
  --warning: #c58a3d;
  --danger: #c76b6b;

  --shadow: 0 14px 34px rgba(46, 77, 109, 0.08);
  --shadow-soft: 0 8px 20px rgba(46, 77, 109, 0.06);

  --radius: 20px;
  --radius-sm: 14px;
  --max-width: 1180px;
}

*{
  box-sizing: border-box;
}

html{
  font-size: 16px;
}

body{
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a{
  color: inherit;
  text-decoration: none;
}

img{
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select{
  font: inherit;
}

button{
  cursor: pointer;
}

.container{
  width: min(calc(100% - 32px), var(--max-width));
  margin: 0 auto;
}

.hidden{
  display: none !important;
}

.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.page-shell{
  min-height: 100vh;
}

.topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(244, 247, 251, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(217, 227, 236, 0.95);
}

.topbar-inner{
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand{
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}

.brand-badge{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, #9bb7d7, #6f96c9 58%, #5d84b8);
  box-shadow: 0 8px 18px rgba(111, 150, 201, 0.24);
}

.topbar-actions{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-pill{
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--border);
  color: var(--muted);
  box-shadow: var(--shadow-soft);
}

.page-main{
  padding: 32px 0 46px;
}

.section-title{
  margin: 0 0 8px;
  font-size: clamp(1.4rem, 2vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.section-subtitle{
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.field{
  display: grid;
  gap: 8px;
}

.label{
  display: block;
  margin-bottom: 2px;
  font-weight: 700;
  color: #334155;
}

.input,
.textarea,
.select{
  width: 100%;
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.input::placeholder,
.textarea::placeholder{
  color: #94a3b8;
}

.input:focus,
.textarea:focus,
.select:focus{
  border-color: #9bb7d7;
  box-shadow: 0 0 0 4px rgba(111, 150, 201, 0.12);
  background: #fff;
}

.textarea{
  min-height: 120px;
  resize: vertical;
}

.form-stack{
  display: grid;
  gap: 16px;
}

.btn{
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
  transition: 0.2s ease;
}

.btn:hover{
  transform: translateY(-1px);
}

.btn:disabled{
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary{
  background: var(--primary);
  color: white;
  box-shadow: 0 8px 18px rgba(111, 150, 201, 0.18);
}

.btn-primary:hover{
  background: var(--primary-hover);
}

.btn-secondary{
  background: rgba(255,255,255,0.92);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover{
  background: #f8fbfd;
}

.btn-danger{
  background: #fbeaea;
  color: #9f4a4a;
  border: 1px solid #efcaca;
}

.btn-success{
  background: #e8f4ec;
  color: #3f755b;
  border: 1px solid #c9e2d1;
}

.status{
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: white;
}

.status.success{
  color: #3f755b;
  background: #edf7f0;
  border-color: #cce5d4;
}

.status.error{
  color: #9f4a4a;
  background: #fcf1f1;
  border-color: #efcaca;
}

.status.info{
  color: #476b96;
  background: #eef5fb;
  border-color: #cfe0f1;
}

.helper{
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.6;
}

.empty-state{
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.badges{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge{
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: #f5f9fc;
  color: #516274;
}

.badge.success{
  background: #edf7f0;
  color: #3f755b;
  border-color: #cce5d4;
}

.badge.warn{
  background: #fbf3e8;
  color: #a06d2f;
  border-color: #efd6b3;
}

.badge.info{
  background: #eef5fb;
  color: #476b96;
  border-color: #cfe0f1;
}

.modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(31, 42, 55, 0.34);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-backdrop.show{
  display: flex;
}

.modal{
  width: min(100%, 900px);
  max-height: min(90vh, 900px);
  overflow: auto;
  background: white;
  border-radius: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 22px 60px rgba(46, 77, 109, 0.16);
  padding: 22px;
}

.modal-head{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.code-box{
  background: #233042;
  color: #e8eef5;
  border-radius: 16px;
  padding: 16px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

@media (max-width: 900px){
  .topbar-inner{
    align-items: flex-start;
    padding: 14px 0;
    flex-direction: column;
  }

  .modal{
    padding: 18px;
  }
}