:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef2f0;
  color: #16211d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
}

.panel {
  align-self: start;
  background: #fbfdfb;
  border: 1px solid #d8e0dc;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 18px 45px rgba(30, 51, 43, 0.12);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid #e2e8e4;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 8px;
  color: #fff;
  background: #c7333d;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.2;
}

.brand p {
  margin-top: 4px;
  color: #63716b;
  font-size: 13px;
  line-height: 1.45;
}

.control-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: #34423d;
  font-size: 13px;
  font-weight: 700;
}

select,
input[type="number"],
input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd7d1;
  border-radius: 8px;
  background: #fff;
  color: #17241f;
  padding: 0 12px;
}

textarea {
  min-height: 72px;
  padding-top: 10px;
  padding-bottom: 10px;
  resize: vertical;
}

select:focus,
input:focus,
textarea:focus {
  outline: 3px solid rgba(199, 51, 61, 0.18);
  border-color: #c7333d;
}

.size-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.toggle-line {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.toggle-line input {
  width: 18px;
  height: 18px;
  accent-color: #c7333d;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 18px;
}

button {
  min-height: 42px;
  border: 1px solid #ccd8d3;
  border-radius: 8px;
  background: #fff;
  color: #1d2b26;
  cursor: pointer;
  font-weight: 800;
}

button.primary {
  border-color: #a72731;
  background: #c7333d;
  color: #fff;
}

button.danger {
  border-color: #d9b3b6;
  background: #fff;
  color: #b23b43;
}
button.danger:hover {
  background: #fbeaec;
}

button:hover,
.button-link:hover {
  filter: brightness(0.98);
}

.button-link {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid #ccd8d3;
  border-radius: 8px;
  background: #fff;
  color: #1d2b26;
  cursor: pointer;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.button-link.primary {
  border-color: #a72731;
  background: #c7333d;
  color: #fff;
}

.link-box {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #dfe7e3;
  border-radius: 8px;
  background: #f5f8f6;
}

.link-box .button-row {
  grid-template-columns: 1fr 1fr;
  margin-top: 0;
}

.project-box {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #dfe7e3;
  border-radius: 8px;
  background: #ffffff;
}

.project-box h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}

.saved-list {
  display: grid;
  gap: 8px;
}

.empty-note {
  margin: 0;
  color: #63716b;
  font-size: 13px;
  line-height: 1.35;
}

.saved-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid #e0e7e3;
  border-radius: 8px;
  background: #f8faf9;
}

.saved-item strong,
.saved-item span {
  display: block;
}

.saved-item span {
  margin-top: 3px;
  color: #63716b;
  font-size: 12px;
}

.saved-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.saved-actions a,
.saved-actions button {
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid #ccd8d3;
  border-radius: 8px;
  background: #fff;
  color: #1d2b26;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.meta-box {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e2e8e4;
  color: #607069;
  font-size: 12px;
}

.meta-box a {
  color: #a72731;
  font-weight: 800;
  text-decoration: none;
}

.meta-box button {
  min-height: auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: #a72731;
  font-size: 12px;
  font-weight: 800;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at top, #ffffff 0, #eef2f0 46%, #dfe7e3 100%);
}

.login-shell {
  width: min(100%, 420px);
}

.login-card {
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid #d8e0dc;
  border-radius: 12px;
  background: #fbfdfb;
  box-shadow: 0 24px 60px rgba(30, 51, 43, 0.16);
}

[hidden] {
  display: none !important;
}

.login-card .brand-mark {
  margin: 0 auto;
}

.login-card h1,
.login-card p {
  text-align: center;
}

.login-card h1 {
  font-size: 24px;
}

.login-card p {
  color: #63716b;
  line-height: 1.45;
}

.preview-zone {
  min-width: 0;
}

.viewer-body {
  min-height: 100vh;
  background: #f8faf9;
}

.viewer-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 0;
}

.project-body {
  min-height: 100vh;
  background: #eef2f0;
}

.project-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.project-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #d8e0dc;
}

.project-header h1 {
  margin-top: 4px;
  font-size: 24px;
  line-height: 1.15;
}

#projectMeta {
  color: #53635d;
  font-size: 13px;
  font-weight: 800;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, max-content));
  gap: 20px;
  align-items: start;
}

.project-widget-frame {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d8e0dc;
  border-radius: 8px;
  background: #fbfdfb;
  box-shadow: 0 14px 34px rgba(30, 51, 43, 0.1);
}

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

.project-widget-frame a {
  color: #a72731;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.project-widget-frame iframe {
  max-width: calc(100vw - 72px);
  border: 0;
  background: #f8faf9;
}

.ruler {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #53635d;
  font-size: 13px;
  font-weight: 800;
}

.stage {
  min-height: calc(100vh - 92px);
  overflow: auto;
  padding: 24px;
  border: 1px dashed #adbbb5;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(31, 52, 44, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(31, 52, 44, 0.05) 1px, transparent 1px),
    #f8faf9;
  background-size: 20px 20px;
}

.pharmacy-widget {
  --widget-font: 14px;
  --widget-pad: 16px;
  --widget-gap: 10px;
  width: 480px;
  height: 320px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--widget-gap);
  padding: var(--widget-pad);
  border-radius: 8px;
  border: 1px solid #d3ddd8;
  background: #ffffff;
  color: #17231f;
  box-shadow: 0 16px 35px rgba(20, 34, 28, 0.15);
  font-size: var(--widget-font);
}

.theme-clinical {
  border-top: 5px solid #c7333d;
}

.theme-contrast {
  background: #161d1a;
  color: #f6fbf8;
  border-color: #313f39;
  border-top: 5px solid #f4c95d;
}

.theme-soft {
  background: #fffaf2;
  color: #24302a;
  border-color: #ead8bd;
  border-top: 5px solid #3f7f73;
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex: 0 0 auto;
}

.company-name {
  flex: 0 0 auto;
  text-align: center;
  font-size: var(--company-font-size, 22px);
  font-weight: 900;
  line-height: 1.15;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.company-name[hidden] {
  display: none;
}

.eyebrow {
  display: block;
  color: #c7333d;
  font-size: 0.76em;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.theme-contrast .eyebrow {
  color: #f4c95d;
}

.theme-soft .eyebrow {
  color: #276a60;
}

.widget-header h2 {
  margin-top: 2px;
  font-size: 1.22em;
  line-height: 1.15;
}

#countBadge {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  background: #edf3f0;
  color: #c7333d;
  font-size: 1em;
}

.theme-contrast #countBadge {
  background: #25322d;
  color: #f4c95d;
}

.theme-soft #countBadge {
  background: #edf5ee;
  color: #276a60;
}

.notice {
  flex: 0 0 auto;
  border-left: 3px solid currentColor;
  padding: 7px 9px;
  background: rgba(199, 51, 61, 0.07);
  color: #5a342f;
  font-size: 0.82em;
  line-height: 1.25;
}

.theme-contrast .notice {
  color: #f7df98;
  background: rgba(244, 201, 93, 0.12);
}

.theme-soft .notice {
  color: #31574f;
  background: rgba(63, 127, 115, 0.1);
}

.pharmacy-list {
  display: grid;
  gap: calc(var(--widget-gap) * 0.8);
  min-height: 0;
}

.pharmacy-card {
  display: grid;
  grid-template-columns: minmax(84px, 0.9fr) minmax(120px, 1.6fr) auto;
  gap: 9px;
  align-items: start;
  padding: 9px;
  border: 1px solid rgba(111, 128, 121, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.theme-contrast .pharmacy-card {
  background: rgba(255, 255, 255, 0.05);
}

.pharmacy-card h3 {
  margin: 0;
  font-size: 1em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.pharmacy-card p {
  color: inherit;
  opacity: 0.82;
  font-size: 0.86em;
  line-height: 1.25;
}

.phone {
  color: #c7333d;
  font-size: 0.9em;
  font-weight: 900;
  white-space: nowrap;
}

.theme-contrast .phone {
  color: #f4c95d;
}

.theme-soft .phone {
  color: #276a60;
}

.district {
  display: inline-block;
  width: max-content;
  max-width: 100%;
  margin-top: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #edf3f0;
  color: #44534e;
  font-size: 0.76em;
  font-weight: 900;
}

.theme-contrast .district {
  background: #25322d;
  color: #dbe8e1;
}

.hint {
  margin-top: 4px;
  font-style: italic;
}

.widget-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 4px;
  color: inherit;
  opacity: 0.58;
  font-size: 0.76em;
}

.density-compact {
  --widget-gap: 7px;
  --widget-pad: 12px;
}

.density-compact .pharmacy-card {
  padding: 7px;
}

.density-mini {
  --widget-gap: 5px;
  --widget-pad: 10px;
}

.density-mini .pharmacy-card {
  grid-template-columns: minmax(72px, 0.9fr) minmax(110px, 1.5fr) auto;
  gap: 6px;
  padding: 6px;
}

.fitting-tight .hint,
.fitting-tight .widget-footer {
  display: none;
}

.fitting-tight .notice {
  padding: 5px 7px;
}

.fitting-tiny {
  --widget-gap: 4px;
  --widget-pad: 8px;
}

.fitting-tiny .notice,
.fitting-tiny .district {
  display: none;
}

.fitting-tiny .pharmacy-card {
  grid-template-columns: 0.75fr 1.25fr;
  gap: 5px;
  padding: 5px;
}

.fitting-tiny .phone {
  grid-column: 1 / -1;
  font-size: 0.86em;
}

@media (max-width: 900px) {
  .app-shell {
    padding: 14px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .stage {
    min-height: 420px;
    padding: 14px;
  }
}

@media (max-width: 560px) {
  .size-row {
    grid-template-columns: 1fr;
  }

  .ruler {
    display: grid;
  }
}

/* Builder: 3 adımlı sade akış */
.step { margin-top: 14px; grid-template-columns: minmax(0, 1fr); }
.step label, .step input, .step .saved-list { min-width: 0; }
.step h2 { display: flex; align-items: center; gap: 8px; }
.step-no {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #a72731;
  color: #fff;
  font-size: 12px;
}
.step .control-grid { margin-top: 0; }
.inline-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.project-settings summary { cursor: pointer; font-size: 13px; font-weight: 800; color: #607069; }
.project-settings[open] summary { margin-bottom: 12px; }
.link-actions { grid-template-columns: repeat(3, 1fr); }
.link-actions .button-link { justify-content: center; }
.saved-title { margin: 4px 0 0; font-size: 13px; color: #607069; }
.ruler button { min-height: auto; padding: 2px 10px; font-size: 12px; }
[hidden] { display: none !important; }
.step .saved-item { grid-template-columns: minmax(0, 1fr); }
.step .saved-actions { justify-content: flex-start; flex-wrap: wrap; }
.saved-title small { font-weight: 400; }
.saved-name { display: grid; gap: 2px; justify-items: start; min-height: auto; padding: 4px 6px; border: 0; background: transparent; text-align: left; }
.saved-name span { font-size: 12px; color: #607069; }
.saved-name:hover { background: #eef3f0; }
.saved-item.active { border-color: #a72731; background: #fbefef; }
