/* ============================================================
   developers.soritune.com — global stylesheet
   Base element styles first so EVERY control (incl. JS-generated
   buttons/links with no class) is styled, then components.
   ============================================================ */

/* ---- Design tokens ---- */
:root {
  --ink:#37352f; --muted:#7a736a; --primary:#7C53D8; --primary-dark:#6843c4;
  --hairline:#e6e4df; --canvas:#ffffff; --surface:#fbfbfa; --error:#ef4444;
  --ok:#16a34a; --radius:10px; --shadow:0 1px 3px rgba(15,15,15,.08);
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, "Pretendard", system-ui, "Apple SD Gothic Neo", sans-serif;
  color: var(--ink); margin: 0; background: var(--surface); line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 10px; }
p { margin: 0 0 8px; }

/* ---- Base form controls (used everywhere, classed or not) ---- */
input, select, textarea {
  font: inherit; width: 100%; padding: 9px 11px; color: var(--ink);
  background: #fff; border: 1px solid var(--hairline); border-radius: 8px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,83,216,.15);
}
textarea { min-height: 72px; resize: vertical; }
select { appearance: none; background-image:
  linear-gradient(45deg, transparent 50%, var(--muted) 50%),
  linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px;
}

/* ---- Base buttons: neutral by default, hover feedback ---- */
button {
  font: inherit; font-weight: 500; cursor: pointer;
  padding: 8px 14px; border: 1px solid var(--hairline);
  border-radius: 8px; background: #fff; color: var(--ink);
  transition: background .12s ease, border-color .12s ease;
}
button:hover { background: var(--surface); border-color: #d8d4cd; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }

/* Primary buttons: page-header CTA, login, dialog OK, submit, .page <form> action */
.page-header button, .login-shell button, button[type="submit"],
dialog form button[value="ok"], .page form button, .btn-primary, #grantBtn {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.page-header button:hover, .login-shell button:hover, button[type="submit"]:hover,
dialog form button[value="ok"]:hover, .page form button:hover, .btn-primary:hover, #grantBtn:hover {
  background: var(--primary-dark); border-color: var(--primary-dark);
}
/* Dialog cancel stays neutral even though it's not value=ok */
dialog form button[value="cancel"] { background: #fff; color: var(--ink); border-color: var(--hairline); }
dialog form button[value="cancel"]:hover { background: var(--surface); }

/* ---- Top navigation ---- */
.topnav {
  display: flex; gap: 16px; align-items: center; font-size: 14px;
  padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--hairline);
}
.topnav strong { margin-right: 12px; }
.topnav a { color: var(--muted); text-decoration: none; padding: 4px 2px; }
.topnav a:hover { color: var(--ink); }
.topnav .grow { flex: 1; }

/* ---- Page shell ---- */
.page { max-width: 1100px; margin: 28px auto; padding: 0 24px; }
.page section { margin-bottom: 32px; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; }
.back-link, .page > a { display: inline-block; margin-bottom: 12px; color: var(--muted); text-decoration: none; font-size: 14px; }
.back-link:hover, .page > a:hover { color: var(--ink); }

/* Generic forms on content pages (e.g. me.php) */
.page form { display: grid; gap: 14px; max-width: 420px; }
.page form label { display: grid; gap: 5px; font-size: 14px; color: var(--muted); }
.page form button { justify-self: start; }

/* ---- Login ---- */
.login-shell { max-width: 360px; margin: 84px auto; padding: 0 16px; }
.login-shell p { color: var(--muted); }
.login-shell form { display: grid; gap: 14px; margin-top: 24px; }
.login-shell label { display: grid; gap: 5px; font-size: 14px; color: var(--muted); }
.login-shell button { width: 100%; padding: 11px; }

/* ---- Alerts ---- */
.error { background: #fee2e2; color: var(--error); padding: 9px 13px; border-radius: 8px; font-size: 13px; }

/* ---- Project cards ---- */
.project-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.project-card { padding: 20px; border-radius: var(--radius); border: 1px solid var(--hairline); background: #fff; box-shadow: var(--shadow); }
.project-card h2 { margin: 0 0 4px; font-size: 18px; }
.project-card .slug { color: var(--muted); font-size: 13px; margin: 0 0 4px; }
.project-card p { color: var(--muted); font-size: 14px; }
.project-card .urls { display: flex; gap: 8px; margin-top: 14px; }
.project-card .card-actions { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }

/* Links inside cards rendered as pill buttons so they look clickable */
.urls a, .card-actions a {
  display: inline-block; font-size: 13px; text-decoration: none;
  padding: 6px 12px; border-radius: 7px; border: 1px solid var(--hairline);
  background: rgba(255,255,255,.7); color: var(--ink);
}
.urls a:hover, .card-actions a:hover { background: #fff; border-color: var(--primary); color: var(--primary); }
.card-actions button { padding: 6px 12px; font-size: 13px; }

/* Tint backgrounds keep cards faintly colored; inner pills stay legible */
.tint-peach { background: #ffe9d6; } .tint-rose { background: #fce4ec; }
.tint-mint { background: #d5f5e3; } .tint-lavender { background: #e7e2f7; }
.tint-sky { background: #d8ecf9; } .tint-yellow { background: #fff5ce; }

/* ---- Data tables ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }
.data-table th { padding: 10px 12px; text-align: left; background: var(--surface); color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--hairline); }
.data-table td { padding: 9px 12px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td button { padding: 5px 10px; font-size: 13px; margin-right: 4px; }

/* ---- Member management list ---- */
#members { list-style: none; padding: 0; margin: 0 0 8px; }
#members li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: #fff; border: 1px solid var(--hairline); border-radius: 8px; margin-bottom: 8px; font-size: 14px; }
#members li button { padding: 5px 10px; font-size: 13px; }
#userSelect { width: auto; min-width: 240px; margin-right: 8px; }

/* ---- Dialog (modal forms) ---- */
dialog { padding: 0; border: 0; border-radius: var(--radius); box-shadow: 0 12px 40px rgba(15,15,15,.2); }
dialog::backdrop { background: rgba(15,15,15,.35); }
dialog form { padding: 24px; min-width: 380px; max-width: 460px; display: grid; gap: 13px; }
dialog form h2 { margin-bottom: 2px; }
dialog form label { display: grid; gap: 5px; font-size: 14px; color: var(--muted); }
dialog form menu { display: flex; gap: 8px; justify-content: flex-end; padding: 0; margin: 8px 0 0; }

/* ---- Misc ---- */
.hint { color: var(--muted); font-size: 13px; }
.slug { color: var(--muted); font-size: 13px; }
code { background: var(--surface); padding: 2px 6px; border-radius: 5px; font-size: 13px; }

/* ---- Project detail (Plan B observability) ---- */
.stat-card { padding: 16px; border: 1px solid var(--hairline); border-radius: var(--radius); background: #fff; }
.git-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.git-cards h3 { margin: 0 0 8px; font-size: 15px; }
.commit-log { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; }
.commit-log li { padding: 3px 0; border-bottom: 1px solid var(--surface); }
.meta p { margin: 4px 0; font-size: 14px; }
/* Pill badges (spec §7.2 rounded.full) — base + site up/down + status modifiers below */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface); color: var(--muted); }
.badge.ok { background: #dcfce7; color: var(--ok); }
.badge.bad { background: #fee2e2; color: var(--error); }
/* Task-status badge colors, shared by employee (/p) and admin views — spec §7.3 */
.badge-drafting, .badge-on_hold { background:#f0efec; color:var(--muted); }
.badge-dev_pending, .badge-dev_deploying, .badge-prod_deploying { background:#ffe9d6; color:#9a5b2d; }
.badge-dev_ready { background:#d6f5e3; color:#15803d; }
.badge-review_requested { background:#ece4fb; color:var(--primary-dark); }
.badge-changes_requested { background:#ffe6cc; color:#9a5b2d; }
.badge-approved { background:#e2dbf6; color:var(--primary-dark); }
.badge-prod_done { background:#cdeedd; color:#15803d; font-weight:700; }
.badge-failed { background:#fde2e1; color:var(--error); }
/* Project-request statuses (reuse the status palette tone — spec §E) */
.badge-pending { background:#ffe9d6; color:#9a5b2d; }
.badge-rejected { background:#fde2e1; color:var(--error); }
.badge-cancelled { background:#f0efec; color:var(--muted); }
.ok { color: var(--ok); } .warn { color: #b45309; } .bad { color: var(--error); } .muted { color: var(--muted); }
.logbox { background: #1e1e1e; color: #e6e6e6; padding: 12px; border-radius: 8px; font-size: 12px; overflow-x: auto; white-space: pre-wrap; }
@media (max-width: 720px) { .git-cards { grid-template-columns: 1fr; } }

/* ---- Employee task UI (/p) ---- */
.tasklist .task{border:1px solid #eaeaea;border-radius:12px;padding:12px;margin:8px 0}
.task-h{display:flex;justify-content:space-between;align-items:center;gap:8px}
.task-actions{display:flex;gap:8px;align-items:center;margin-top:8px}
.task-actions .btn-primary{min-height:44px}
.progress{font-size:.9em;color:#555}
.cards{display:flex;flex-wrap:wrap;gap:10px;margin:12px 0}
.cards .card{display:flex;flex-direction:column;align-items:flex-start;padding:14px 18px;border:1px solid #eaeaea;border-radius:12px;background:#fff;cursor:pointer;min-width:160px;text-align:left}
.cards .card small{color:#888;font-size:.8em;margin-top:4px}
.review-list{margin:8px 0;padding-left:18px}
.admin-comment{margin:6px 0;padding:6px 10px;border-left:3px solid #ffb86b;background:#fff7ee;color:#663;font-size:.9em}

/* ---- Admin dashboard quickstart ---- */
.flow{list-style:none;display:flex;flex-wrap:wrap;gap:8px;padding:0;margin:8px 0 0}
.flow li{display:flex;align-items:center;gap:8px;background:#fff;border:1px solid var(--hairline);border-radius:10px;padding:10px 14px;font-size:14px}
.flow .n{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:999px;background:var(--primary);color:#fff;font-size:12px;font-weight:700;flex:none}
.quickstart{list-style:none;padding:0;margin:8px 0 0;display:grid;gap:10px}
.quickstart li{display:flex;align-items:center;gap:12px;padding:14px 16px;border:1px solid var(--hairline);border-radius:var(--radius);background:#fff;flex-wrap:wrap}
.quickstart .qs-label{font-weight:600;min-width:84px}
.quickstart .qs-count{display:inline-flex;align-items:center;justify-content:center;min-width:30px;height:24px;padding:0 8px;border-radius:999px;font-size:13px;font-weight:700;background:var(--surface);color:var(--muted)}
.quickstart .qs-hint{color:var(--muted);font-size:13px;flex:1;min-width:140px}
.quickstart .qs-cta{white-space:nowrap;text-decoration:none;font-size:13px;padding:6px 12px;border-radius:7px;border:1px solid var(--hairline);color:var(--ink)}
.quickstart .qs-cta:hover{border-color:var(--primary);color:var(--primary)}
.quickstart li.qs-todo{border-color:#f0c98a;background:#fff8ec}
.quickstart li.qs-todo .qs-count{background:#ffe6cc;color:#9a5b2d}
.quickstart li.qs-attention{border-color:#cdbdf0;background:#f7f4fe}
.quickstart li.qs-attention .qs-count{background:#ece4fb;color:var(--primary-dark)}
.quickstart li.qs-todo .qs-cta,.quickstart li.qs-attention .qs-cta{background:var(--primary);color:#fff;border-color:var(--primary)}
.quickstart li.qs-todo .qs-cta:hover,.quickstart li.qs-attention .qs-cta:hover{background:var(--primary-dark);border-color:var(--primary-dark);color:#fff}

/* ---- Dashboard "직원에게 공유" card ---- */
.share-card{border:1px solid var(--hairline);border-radius:var(--radius);background:#fff;padding:16px 18px;box-shadow:var(--shadow)}
.share-card>p{margin:0 0 12px;font-size:14px}
.share-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.share-actions .share-cta{display:inline-block;text-decoration:none;padding:9px 16px;border-radius:8px;background:var(--primary);color:#fff;font-weight:500;font-size:14px;border:1px solid var(--primary)}
.share-actions .share-cta:hover{background:var(--primary-dark);border-color:var(--primary-dark)}
.share-url{color:var(--muted)}
.copy-btn{padding:8px 13px;font-size:13px}

/* ---- Start guide (/guide/start.php) ---- */
.wrap{max-width:760px;margin:32px auto;padding:0 20px}
.wrap>h1{margin-bottom:6px}
.wrap>p{color:var(--muted)}
.wrap h2{margin:30px 0 12px}
.wrap ol{list-style:none;counter-reset:step;padding:0;margin:22px 0 0;display:grid;gap:14px}
.wrap ol>li{counter-increment:step;position:relative;background:#fff;border:1px solid var(--hairline);border-radius:var(--radius);box-shadow:var(--shadow);padding:16px 18px 16px 58px}
.wrap ol>li::before{content:counter(step);position:absolute;left:16px;top:16px;width:28px;height:28px;border-radius:999px;background:var(--primary);color:#fff;font-weight:700;font-size:14px;display:flex;align-items:center;justify-content:center}
.wrap ol>li h3{margin:3px 0 8px;font-size:16px}
.wrap ol>li p{margin:0 0 6px}
.wrap ol>li>*:last-child{margin-bottom:0}
.wrap ol .logbox{margin:8px 0 0}
.wrap #projects{display:grid;gap:12px;margin-top:8px}
.wrap #projects .stat-card{width:100%;box-shadow:var(--shadow)}
.wrap #projects .stat-card h3{margin:0 0 8px;font-size:15px}
.wrap #projects .stat-card .logbox{margin:8px 0}
.wrap #projects .stat-card a{display:inline-block;margin-top:8px}

/* ---- Field help [?] ---- */
.help{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-left:5px;padding:0;border-radius:999px;border:1px solid var(--hairline);background:#fff;color:var(--muted);font-size:11px;font-weight:700;line-height:1;cursor:pointer;vertical-align:middle}
.help:hover{border-color:var(--primary);color:var(--primary)}
.help-pop{position:absolute;z-index:120;max-width:280px;background:var(--ink);color:#fff;font-size:12.5px;font-weight:400;line-height:1.5;padding:9px 12px;border-radius:8px;box-shadow:0 8px 28px rgba(15,15,15,.28)}

/* ---- Project requests: admin section (projects.php #reqSection) ---- */
.req-section{margin:0 0 20px}
.req-section:empty{display:none}
.req-section h2{margin:0 0 10px;font-size:17px}
.req-row{display:flex;justify-content:space-between;align-items:flex-start;gap:14px;flex-wrap:wrap;border:1px solid #cdbdf0;background:#f7f4fe;border-radius:var(--radius);padding:14px 16px;margin:0 0 10px}
.req-info{display:flex;flex-direction:column;gap:3px;min-width:200px;flex:1}
.req-info strong{font-size:15px}
.req-info p{margin:4px 0 0;font-size:14px}
.req-meta{color:var(--muted);font-size:12.5px}
.req-actions{display:flex;gap:8px;align-items:center}

/* ---- Project requests: employee list (/p #reqList) ---- */
.requests-block{margin:22px 0 8px}
.rq-head{display:flex;justify-content:space-between;align-items:center;gap:10px}
.rq-head h2{margin:0;font-size:18px}
.reqlist{margin-top:10px}
.reqlist .rq{border:1px solid #eaeaea;border-radius:12px;padding:12px;margin:8px 0}
.rq-h{display:flex;justify-content:space-between;align-items:center;gap:8px}
.rq-h .title{font-weight:600}
.reqlist .rq p{margin:6px 0 0;font-size:14px}
.reqlist .rq small{display:block;color:#888;font-size:.85em;margin-top:4px}
.rq-actions{display:flex;gap:8px;margin-top:8px}
