/* TALK APP — phone-first chat app for The Studio at King & Country Home */
:root{
  --ink:#121212; --text:rgba(18,18,18,.82); --muted:rgba(18,18,18,.52); --line:rgba(18,18,18,.1);
  --bg:#FFFFFF; --soft:#F6F3EE; --card:#FFFFFF; --cream:#F5EFE6; --gold:#C89B3C; --gold-soft:#E3C98F;
  --mine:#121212; --mine-text:#FFFFFF; --them:#F1EEE9; --green:#2DBE60; --red:#D64545;
  --top:env(safe-area-inset-top,0px); --bot:env(safe-area-inset-bottom,0px);
  color-scheme:light;
}
html[data-mode="dark"]{
  --ink:#EDEDED; --text:rgba(237,237,237,.86); --muted:rgba(237,237,237,.5); --line:rgba(255,255,255,.1);
  --bg:#121212; --soft:#1A1A1C; --card:#1C1C1E; --cream:#2A251F; --mine:#C89B3C; --mine-text:#121212; --them:#2A2A2D;
  color-scheme:dark;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;background:var(--bg);color:var(--text);font:16px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;-webkit-text-size-adjust:100%}
button,input,textarea{font:inherit;color:inherit}
a{color:var(--gold)}
svg{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
[hidden]{display:none!important}

/* ----- buttons ----- */
.tk-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:46px;padding:0 20px;border:0;border-radius:23px;background:var(--gold);color:#fff;font-weight:600;font-size:16px;text-decoration:none;cursor:pointer}
.tk-btn.sm{min-height:36px;padding:0 16px;font-size:14px;border-radius:18px;margin-top:12px}
.tk-btn.line{background:none;border:1px solid var(--line);color:var(--ink)}
.tk-btn.wide{width:100%}
.tk-link{border:0;background:none;padding:0;color:var(--gold);text-decoration:underline;cursor:pointer;font-size:inherit}
.tk-ico{flex:0 0 40px;height:40px;display:grid;place-items:center;border:0;background:none;color:var(--ink);border-radius:50%;cursor:pointer;padding:0}
.tk-ico svg{width:24px;height:24px}
.tk-ico:active{background:var(--soft)}

/* ----- sign-in ----- */
.tk-auth{background:var(--soft)}
.tk-login{max-width:420px;margin:0 auto;padding:calc(48px + var(--top)) 22px calc(30px + var(--bot))}
.tk-brand{text-align:center;margin-bottom:26px}
.tk-brand img{border-radius:18px;box-shadow:0 8px 24px rgba(0,0,0,.18)}
.tk-brand h1{font-family:"Cormorant Garamond",Georgia,serif;font-size:40px;font-weight:600;color:var(--ink);margin:14px 0 2px;letter-spacing:.5px}
.tk-brand p{margin:0;color:var(--muted);font-size:14.5px}
.tk-form{background:var(--card);border-radius:18px;padding:22px 20px;box-shadow:0 1px 0 var(--line),0 10px 30px rgba(0,0,0,.05);display:grid;gap:6px}
.tk-form label{font-size:13px;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.6px;margin-top:8px}
.tk-form input[type=email],.tk-form input[type=password],.tk-form input[name=code]{width:100%;height:50px;padding:0 14px;border:1px solid var(--line);border-radius:12px;background:var(--bg);font-size:17px}
.tk-form input[name=code]{font-size:24px;letter-spacing:6px;text-align:center}
.tk-form input:focus{outline:2px solid var(--gold);outline-offset:0;border-color:transparent}
.tk-form .tk-btn{margin-top:14px}
.tk-check{display:flex!important;align-items:center;gap:10px;text-transform:none!important;letter-spacing:0!important;font-size:15px!important;font-weight:500!important;color:var(--text)!important;margin-top:12px!important}
.tk-check input{width:20px;height:20px;accent-color:var(--gold)}
.tk-lead{margin:0 0 4px;font-size:15px}
.tk-small{text-align:center;font-size:14px;color:var(--muted);margin:18px 0 0}
.tk-notice{background:var(--card);border-left:4px solid var(--gold);border-radius:10px;padding:12px 14px;margin:0 0 16px;font-size:15px}
.tk-notice.err{border-left-color:var(--red)}

/* ----- app frame ----- */
.tk-body{overflow:hidden}
.tk-app{position:fixed;inset:0;display:flex;flex-direction:column;background:var(--bg)}
.tk-top{display:flex;align-items:center;gap:8px;padding:calc(10px + var(--top)) 12px 4px 18px}
.tk-title{flex:1;margin:0;font-size:30px;font-weight:750;color:var(--ink);letter-spacing:-.4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tk-new{background:var(--soft)}
.tk-searchbar{display:flex;align-items:center;gap:8px;margin:6px 14px 6px;padding:0 12px;height:40px;border-radius:12px;background:var(--soft);color:var(--muted)}
.tk-searchbar svg{width:18px;height:18px;flex:0 0 18px}
.tk-searchbar input{flex:1;border:0;background:none;outline:0;height:100%;font-size:16px;min-width:0}
.tk-main{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
.tk-nav{display:flex;border-top:1px solid var(--line);background:var(--bg);padding-bottom:var(--bot)}
.tk-nav button{position:relative;flex:1;height:58px;border:0;background:none;color:var(--muted);display:grid;place-items:center;cursor:pointer}
.tk-nav button svg{width:27px;height:27px}
.tk-nav button.on{color:var(--gold)}
.tk-nav button.on svg{stroke-width:2.2}
.tk-badge{position:absolute;top:7px;left:calc(50% + 6px);min-width:19px;height:19px;padding:0 5px;border-radius:10px;background:var(--red);color:#fff;font-size:11.5px;font-weight:700;line-height:19px;text-align:center;box-shadow:0 0 0 2px var(--bg)}

/* ----- lists ----- */
.tk-list{display:flex;flex-direction:column}
.tk-item{display:flex;align-items:center;gap:13px;width:100%;padding:10px 16px;border:0;background:none;text-align:left;cursor:pointer;text-decoration:none;color:inherit}
.tk-item:active{background:var(--soft)}
.tk-txt{flex:1;min-width:0;display:grid;gap:1px;padding:4px 0;border-bottom:1px solid var(--line)}
.tk-item:last-child .tk-txt{border-bottom:0}
.tk-line{display:flex;align-items:center;gap:8px;min-width:0}
.tk-line strong{flex:1;min-width:0;font-size:16.5px;font-weight:600;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tk-line em{font-style:normal;font-size:13px;color:var(--muted);white-space:nowrap}
.tk-last{flex:1;min-width:0;font-size:14.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tk-last.on{color:var(--green)}
.tk-item.unread .tk-last{color:var(--ink);font-weight:500}
.tk-item.unread .tk-line em{color:var(--gold);font-weight:600}
.tk-count{min-width:21px;height:21px;padding:0 6px;border-radius:11px;background:var(--gold);color:#fff;font-size:12px;font-weight:700;line-height:21px;text-align:center}
.tk-tags{display:flex;flex-wrap:wrap;gap:5px;margin-top:4px}
.tk-tags i{font-style:normal;font-size:11.5px;padding:1px 8px;border-radius:10px;background:var(--soft);color:var(--muted)}
.tk-owner{color:var(--gold)!important;font-weight:600}
.tk-empty{display:grid;justify-items:center;text-align:center;gap:8px;padding:56px 32px;color:var(--muted)}
.tk-empty>svg{width:46px;height:46px;color:var(--gold-soft)}
.tk-empty p{margin:0;font-size:15px;line-height:1.5}
.tk-empty.small{padding:34px 24px}

/* ----- avatars ----- */
.tk-av{position:relative;flex:0 0 52px;width:52px;height:52px}
.tk-av img,.tk-av .ini{width:100%;height:100%;border-radius:50%;object-fit:cover;display:grid;place-items:center;background:var(--cream);color:var(--ink);font-weight:700;font-size:17px}
.tk-dot{position:absolute;right:1px;bottom:1px;width:13px;height:13px;border-radius:50%;background:var(--green);box-shadow:0 0 0 2.5px var(--bg)}
.tk-group{display:grid;place-items:center;border-radius:50%;background:var(--cream);color:var(--gold)}
.tk-group svg{width:28px;height:28px}
.tk-av.sm{flex-basis:30px;width:30px;height:30px}
.tk-av.sm .ini{font-size:11px}
.tk-av.sm .tk-dot{display:none}
.tk-av.tk-sp{flex-basis:30px;width:30px;height:1px}
.tk-av.lg{flex-basis:68px;width:68px;height:68px}
.tk-av.lg .ini{font-size:22px}
.tk-av.lg svg{width:36px;height:36px}

/* ----- chat screen ----- */
.tk-thread,.tk-sheet{position:fixed;inset:0;z-index:10;display:flex;flex-direction:column;background:var(--bg);transform:translateX(100%);transition:transform .22s ease}
.tk-sheet{z-index:20;transform:translateY(100%)}
.tk-thread.in,.tk-sheet.in{transform:none}
.tk-thead{display:flex;align-items:center;gap:8px;padding:calc(6px + var(--top)) 6px 6px 4px;border-bottom:1px solid var(--line);background:var(--bg)}
.tk-thead .tk-av{flex-basis:38px;width:38px;height:38px}
.tk-thead .tk-av .ini{font-size:13px}
.tk-thead .tk-group svg{width:22px;height:22px}
.tk-thead .tk-dot{width:10px;height:10px}
.tk-thtitle{flex:1;min-width:0;display:grid;line-height:1.25}
.tk-thtitle strong{font-size:16.5px;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tk-thtitle strong a{color:inherit;text-decoration:none}
.tk-thtitle small{font-size:12.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tk-thtitle small.on{color:var(--green)}
.tk-msgs{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;padding:10px 12px 8px;display:flex;flex-direction:column;gap:2px;background:var(--soft)}
.tk-day{display:flex;justify-content:center;margin:12px 0 6px}
.tk-day span{font-size:12px;font-weight:600;color:var(--muted);background:var(--bg);padding:3px 11px;border-radius:11px}
.tk-msg{display:flex;align-items:flex-end;gap:7px;max-width:84%;align-self:flex-start;margin-top:6px}
.tk-msg.cont{margin-top:1px}
.tk-msg.mine{align-self:flex-end}
.tk-bub{display:grid;min-width:0}
.tk-msg.mine .tk-bub{justify-items:end}
.tk-from{font-size:12px;font-weight:700;color:var(--gold);margin:0 0 2px 10px}
.tk-msg .b{background:var(--them);color:var(--ink);padding:8px 13px;border-radius:19px;font-size:16px;line-height:1.4;overflow-wrap:anywhere}
.tk-msg:not(.cont) .b{border-bottom-left-radius:6px}
.tk-msg.mine .b{background:var(--mine);color:var(--mine-text);border-radius:19px 19px 6px 19px}
.tk-msg.mine.cont .b{border-radius:19px 6px 6px 19px}
.tk-msg .b a{color:inherit;text-decoration:underline}
.tk-msg .b a.hashtag,.tk-msg .b a.mention{color:var(--gold);font-weight:600;text-decoration:none}
.tk-msg.mine .b a.hashtag,.tk-msg.mine .b a.mention{color:var(--gold-soft)}
html[data-mode="dark"] .tk-msg.mine .b a.hashtag,html[data-mode="dark"] .tk-msg.mine .b a.mention{color:#121212;text-decoration:underline}
.tk-msg .t{font-size:11px;color:var(--muted);margin:2px 8px 0}
.tk-seen{align-self:flex-end;font-size:11.5px;color:var(--muted);margin:2px 8px 0}
.tk-compose{display:flex;align-items:flex-end;gap:8px;padding:8px 10px calc(8px + var(--bot));border-top:1px solid var(--line);background:var(--bg)}
.tk-compose textarea{flex:1;resize:none;min-height:42px;max-height:140px;padding:10px 15px;border:1px solid var(--line);border-radius:21px;background:var(--soft);font-size:16px;line-height:1.35;outline:0}
.tk-compose textarea:focus{border-color:var(--gold)}
.tk-compose button{flex:0 0 42px;height:42px;border-radius:50%;border:0;background:var(--gold);color:#fff;display:grid;place-items:center;cursor:pointer}
.tk-compose button svg{width:20px;height:20px;stroke-width:2}
.tk-compose button:disabled{opacity:.5}
.tk-blocked{margin:0;padding:14px 18px calc(14px + var(--bot));font-size:14px;color:var(--muted);text-align:center;border-top:1px solid var(--line)}
.tk-suggest{display:flex;flex-direction:column;max-height:220px;overflow-y:auto;border-top:1px solid var(--line);background:var(--bg)}
.tk-suggest button{display:flex;align-items:baseline;gap:10px;padding:11px 16px;border:0;background:none;text-align:left;cursor:pointer}
.tk-suggest button.on,.tk-suggest button:active{background:var(--soft)}
.tk-suggest b{color:var(--gold)}
.tk-suggest small{color:var(--muted)}

/* ----- sheet (new chat, team) ----- */
.tk-sheet-body{flex:1;overflow-y:auto;padding-bottom:var(--bot)}
.tk-searchbar.in-sheet{margin:12px 14px}
.tk-info{text-align:center;padding:22px 20px 14px;border-bottom:1px solid var(--line)}
.tk-info h2{margin:2px 0 4px;font-size:21px;color:var(--ink)}
.tk-info-kind{margin:0;font-size:12.5px;text-transform:uppercase;letter-spacing:.8px;color:var(--gold);font-weight:700}
div.tk-item{cursor:default}

/* ----- settings ----- */
[data-view=settings]{padding:4px 16px calc(24px + var(--bot))}
.tk-me{display:flex;align-items:center;gap:14px;padding:12px 4px 6px}
.tk-me div{display:grid}
.tk-me strong{font-size:19px;color:var(--ink)}
.tk-me small{color:var(--muted);font-size:14px}
.tk-me a{font-size:14px;margin-top:2px}
[data-view=settings] h3{font-size:13px;text-transform:uppercase;letter-spacing:.8px;color:var(--muted);margin:22px 4px 8px}
.tk-group-box{background:var(--soft);border-radius:14px;overflow:hidden}
.tk-set{display:flex;align-items:center;gap:14px;padding:13px 14px;border-bottom:1px solid var(--line);cursor:pointer}
.tk-set:last-child{border-bottom:0}
.tk-set span{flex:1;display:grid;gap:2px}
.tk-set strong{font-weight:600;color:var(--ink);font-size:16px}
.tk-set small{color:var(--muted);font-size:13px;line-height:1.35}
.tk-switch{appearance:none;-webkit-appearance:none;flex:0 0 50px;width:50px;height:30px;border-radius:15px;background:rgba(120,120,128,.32);position:relative;cursor:pointer;transition:background .2s;margin:0}
.tk-switch::after{content:"";position:absolute;top:2px;left:2px;width:26px;height:26px;border-radius:50%;background:#fff;box-shadow:0 2px 4px rgba(0,0,0,.2);transition:transform .2s}
.tk-switch:checked{background:var(--green)}
.tk-switch:checked::after{transform:translateX(20px)}
.tk-seg{display:flex;padding:4px;gap:4px}
.tk-seg button{flex:1;height:36px;border:0;border-radius:10px;background:none;cursor:pointer;font-size:14.5px;color:var(--muted)}
.tk-seg button.on{background:var(--bg);color:var(--ink);font-weight:600;box-shadow:0 1px 3px rgba(0,0,0,.12)}
.tk-install{padding:13px 14px}
.tk-install p{margin:0;font-size:14.5px}
.tk-links{margin-top:22px;display:flex;flex-direction:column}
.tk-links a{padding:13px 14px;border-bottom:1px solid var(--line);text-decoration:none;font-weight:500}
.tk-links a:last-child{border-bottom:0}
.tk-signout{margin-top:22px;text-align:center}
.tk-signout small{display:block;margin-top:8px;color:var(--muted);font-size:13px}

@media (min-width:700px){
  .tk-app,.tk-thread,.tk-sheet{max-width:560px;margin:0 auto;left:0;right:0;border-left:1px solid var(--line);border-right:1px solid var(--line)}
  .tk-body{background:var(--soft)}
}
